Skip to content

Access to component full state #73

@guzart

Description

@guzart

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions