Skip to content

getAbortSignal's signal abortion causes maximum tearing #16939

@Thiagolino8

Description

@Thiagolino8

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)
Image
After all derivations are completed successfully, the values ​​synchronize again.
Image

Logs

System Info

running Svelte compiler version 5.39.11

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions