-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Closed
Copy link
Description
Describe the bug
onDestroy doesnt update global stores value (at the same onDestroy function).
- it works with onMount.
- it works with local state rune.
- it was working with svelte4.
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: 0System Info
System:
OS: Windows 10 10.0.19045
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Memory: 4.41 GB / 15.87 GB
Binaries:
Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (127.0.2651.74)
Internet Explorer: 11.0.19041.4355Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels