Skip to content

<svelte:boundary> async reactivity loss #17160

@dylan1951

Description

@dylan1951

Describe the bug

Since 5.43.3 there appears to be some kind of race condition where the rendered value in the boundary can be stale.

Bug seems to have been introduced by #17098

Reproduction

REPL

<script>
    let foo = $state(1);
    let bar = $state(false);

    $effect(() => {
        foo = 2;
        bar = true;
    });

    async function stall() {
        return new Promise(resolve => setTimeout(resolve, 0));
    }

    let baz = $derived(bar ? await stall() : null);
</script>

<p>Outside boundary value: {foo}</p>

<svelte:boundary>
    {#snippet pending()}
        <p>Loading</p>
    {/snippet}

    {@const quux = await stall()}

    <p>Inside boundary value: {foo}</p>
</svelte:boundary>

Logs

System Info

Svelte playground

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions