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 you have an await block and resolve the promise and then change it to a new promise at the same time, the :then block renders twice. If you have any components in this block their onMount will be called twice, but if you later remove them the unmount will only be called once.
The Foo component intentionally errors if there are two mounted at the same time, which reveals the bug. If you change this so that foo counts its mounts/unmounts instead you'll see it mounts twice but will only unmount once even if you completely stop rendering it.
Note the promise resolving on line 22 and then the selected state changing on line 23 which triggers the reactive statement on 32 and immediately creates a new promise. Changing anything about this causes the bug to disappear.
Describe the bug
If you have an
await
block and resolve the promise and then change it to a new promise at the same time, the:then
block renders twice. If you have any components in this block theironMount
will be called twice, but if you later remove them the unmount will only be called once.Reproduction
https://svelte.dev/repl/d3acebb52bf34f73a17d8afa2ddd19ce?version=3.49.0
Some notes:
Logs
No response
System Info
Severity
annoyance
Possibly related
#1591, #5322, #5944, #7806.
The text was updated successfully, but these errors were encountered: