You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a brand new SvelteKit project with Svelte 5, I realized that all my states are reset whenever HMR updates
Whenever I change anything in the HTML part of a Svelte file, HMR kicks in and resets all my $state, which makes it very cumbersome to develop a large and complex form
I read that earlier version support directives such as @hmr:keep-all or preserveLocalState, but according to sveltejs/kit#12985, these are outdated and no longer used
So I am unsure what to do now to preserve states between HMR reloads - is this a bug or a feature request?
Describe the bug
With a brand new SvelteKit project with Svelte 5, I realized that all my states are reset whenever HMR updates
Whenever I change anything in the HTML part of a Svelte file, HMR kicks in and resets all my
$state
, which makes it very cumbersome to develop a large and complex formI read that earlier version support directives such as
@hmr:keep-all
orpreserveLocalState
, but according to sveltejs/kit#12985, these are outdated and no longer usedSo I am unsure what to do now to preserve states between HMR reloads - is this a bug or a feature request?
Reproduction
Reproduction link in SvelteLab: https://www.sveltelab.dev/63iv5zkf3ed2806
Steps to reproduce:
text
resets to initial value 🚩I understand that SvelteLab may not reflect real-world environments, but I tried it on my laptop inside WSL and the "bug" is still there
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: