prismicio / slice-simulator

Preview and develop Prismic slices fast with minimal configuration
6 stars 5 forks source link

feat: preserve state on hot reload in development #6

Closed lihbr closed 2 years ago

lihbr commented 2 years ago

Is your feature request related to a problem? Please describe.

With some frameworks, HMR can behave differently and cause the simulator component to hard reload while developing, ultimately losing its state.

Describe the solution you'd like

Leveraging bundler's HMR APIs

Describe alternatives you've considered

At first, I thought that maybe the simulator could save and recover its state from session storage, not sure this would play nicely.

Additional context

Should not impact production as the simulator shouldn't be responsible for recovering its state in that environment.