Skip to content

$derived(await ...) is a symbolΒ #17271

@dylan1951

Description

@dylan1951

Describe the bug

Since 5.43.0, sometimes the value of a $derived(await ...) is unexpectedly a symbol which can cause errors.

Reproduction

REPL

<script>
    let foo = $state(null);

    $effect(() => {
        foo = 69;
    });

    let bar = $derived(await 1);

    let baz = $derived(foo ? foo * bar : null);

    const qux = "qux";
</script>

<p>baz: {baz}</p>

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

    {#if qux}
        <p></p>
    {/if}
</svelte:boundary>

Logs

Unhandled Promise Rejection: TypeError: Cannot convert a symbol to a number

	in <unknown>
	in __wrapper.svelte



TypeError
@
update_reaction@
execute_derived@
update_derived@
is_dirty@
flush_queued_effects@
process@
flush_effects@
flush@
revive@
decrement@
@
@[native code]

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