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
When updating the code of parent component, the local state of children component is lost(with preserveLocalState: true). While the local state of parent component can be kept.
In below screenshot, the local state of Counter will reset to default when App is change. Because in svelte-hmr, when parent component is changed, it will recreate itself(can keep local state) and it's children components(without keeping local state).
Expected behavior
The local state of children is kept as well when updating parent component, just like react does. It's annoying when debugging between parent component and children components if the local state is lost.
And developer may think it's a bug of HMR because of the inconsistence.
The text was updated successfully, but these errors were encountered:
However, this is probably not something that can be done sanely by externally patching Svelte's compiler output like this package currently does. So HMR will have to be integrated into the compiler first. I have started looking into it, but that's probably still quite a long shot...
Describe the issue
When updating the code of parent component, the local state of children component is lost(with
preserveLocalState: true
). While the local state of parent component can be kept.In below screenshot, the local state of
Counter
will reset to default whenApp
is change. Because insvelte-hmr
, when parent component is changed, it will recreate itself(can keep local state) and it's children components(without keeping local state).Expected behavior
The local state of children is kept as well when updating parent component, just like react does. It's annoying when debugging between parent component and children components if the local state is lost.
And developer may think it's a bug of HMR because of the inconsistence.
The text was updated successfully, but these errors were encountered: