-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
onDestroy doesnt update global stores value (at the same onDestroy function). #14950
Comments
It is kinda related but it's different...the problem is that when |
There's a |
Oh true...this complicates things very much 😄 |
So, this is definitely a departure from Svelte 4 behavior. If you use |
Describe the bug
onDestroy doesnt update global stores value (at the same onDestroy function).
Reproduction
open link: https://svelte.dev/playground/6acd83b2792743c6addd512ed492cdfb?version=5.16.6
press button 2 times to mount and destroy component.
check the logs.
Logs
mounted, before val++ 0 expected: 0 mounted, after val++ 1 expected: 1 destroyed, before val-- 1 expected: 1 destroyed, after val-- 1 expected: 0 <-- this is the problem destroyed, before localVal-- 0 expected: 0 destroyed, after localVal-- -1 expected: -1 destroyed, after val-- (setTimeout) 1 expected: 0
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: