-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prop state on first instance of a custom element are lost when using HMR #21
Comments
…fter HMR updates and that we persist props the same way that normal HMR does when done entirely within Svelte (i.e. restore defaults after HMR only if prop is undefined).
…fter HMR updates and that we persist props the same way that normal HMR does when done entirely within Svelte (i.e. restore defaults after HMR only if prop is undefined).
Root cause analysisBackgroundI wanna get a few concepts and definitions out of the way:
When using Vite HMR + Svelte on its own: Editing a Svelte component results in the component being reloaded via HMR, however there are differences when it comes to maintaining state. For example, using
The Bug 🐞Before fixing in #22, the bug in Cause: This occurred because the The subsequent instance of The Fix 🔧The fix was simply to add each prop to the target Line 447 in c777046
|
Describe the bug
When using HMR (i.e.
vite
in development mode), the first instance of any particularsvelte-retag
loaded component loses state after the first save. This is likely due to an issue with the props proxy which was setup for lit style lowercase props here: https://github.com/patricknelson/svelte-retag/blob/1.3.1/index.js#L430Likely a regression from #18.
Reproduction
link="https://example.com"
) calledExampleComponent.svelte
and ensurelink
prop is used somehow in the componentexample-element
)<example-element link="https://example.com">
yarn vite
to start up dev mode and load page setup in step aboveExampleComponent.svelte
Bug appears when
link
is now empty.Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: