While trying to get Hot Module Reloading for webpack going I couldn't find a way to access the full component state.
if (module.hot) {
module.hot.accept('./components/App.svelte', () => {
const state = app.get(undefined) // Get the full state
app.teardown()
app = new App({ target, data: state })
})
}
I think this feature could also be useful for storing/restoring session state from top level components. The observe callback suffers from the same problem, but dispatching to state observers would take more bytes to handle.
Not sure if this is a featured you should opt-in to, or if it should be part of the get method.
While trying to get Hot Module Reloading for webpack going I couldn't find a way to access the full component state.
I think this feature could also be useful for storing/restoring session state from top level components. The
observecallback suffers from the same problem, but dispatching to state observers would take more bytes to handle.Not sure if this is a featured you should opt-in to, or if it should be part of the
getmethod.