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
If a function which closes over state received via props is called after that component unmounts, the closed over value becomes undefined. This is a breaking change compared to svelte 4, but I don't see it called out in the migration guide or anywhere else in the documentation. Fixing this behavior to allow passing of closures around requires awkward/annoying/error prone value re-assignment.
Describe the bug
If a function which closes over state received via props is called after that component unmounts, the closed over value becomes
undefined
. This is a breaking change compared to svelte 4, but I don't see it called out in the migration guide or anywhere else in the documentation. Fixing this behavior to allow passing of closures around requires awkward/annoying/error prone value re-assignment.Reproduction
Here is a Stack Overflow question that goes into more detail: https://stackoverflow.com/questions/79446266/svelte-5-props-are-undefined-after-unmount
Reproduction source code: https://github.com/staab/svelte5-closure-bug
Reproduction demo: https://svelte5-closure-bug.onrender.com/
Logs
System Info
Severity
annoyance (additional context: I was a big fan of svelte 4. For this reason and others, I don't plan to use svelte for any new projects)
The text was updated successfully, but these errors were encountered: