Skip to content

Uncommitted fork() should not affect $effect.pending() #18649

Description

@adiguba

Describe the bug

I don't know if it's a bug or intentional, but the $effect.pending() rune is affected by promises created via fork(), even if it hasn't been committed.

This causes issues when using $effect.pending() to display a loading state.

I think $effect.pending() should not be affected by fork(), just like $state.eager().

Reproduction

https://svelte.dev/playground/cbfae12100cb456a8d466eb979e91957?version=5.56.9

  • Click "increment" to start loading the data asynchronously.
    The UI is correctly updated to a loading state, thanks to $effect.pending(), and the DOM is updated when the promise resolve.

  • Click "fork" to start loading the data asynchronously without updating the DOM, using fork().
    The DOM will not be updated until the fork is committed, except for $effect.pending() which will put the UI into an unwanted loading state.

Logs

REPL

System Info

REPL

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