-
- Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the bug
Svelte async has a behavior in which asynchronous derivations are rendered in order until the most current derivation is displayed
This behavior is mostly unnoticeable (since derivations don't usually happen in sequence so quickly), but 99% of the time it's an undesirable behavior
To prevent these derivations that are already stale when computed (I call them stillborn derivations) from appearing, Svelte offers a helper called getAbortSignal that allows you to abort stillborn derivations
Unfortunately, when these stillborn branches are aborted, a desynchronization occurs between the parent state and its branch
Reproduction
repl
If you quickly increase the counter to a high number, for example 20, the count value in the input is automatically updated to 20, the count value in the template is updated to 19 as if considering the aborted derivations as successful, and the value of the aborted derivations remains at the value of the last successful derivation (in this case 0)
After all derivations are completed successfully, the values synchronize again.
Logs
System Info
running Svelte compiler version 5.39.11
Severity
annoyance