Skip to content

{#await} breaks $effect cleanup #13573

@WaltzingPenguin

Description

@WaltzingPenguin

Describe the bug

It is reasonable to assume that

{#await fn(value)}

and

let foo = $derived(fn(value))
---
{#await foo}

should have equivalent characteristics. This is currently not true and the cleanup function returned by the $effect triggered by that first syntax will never be called.

Note that $effect.tracking() is true in both scenarios as well.

Reproduction

Cleanup effects triggered from an await block do not work: REPL
Manually wrapping the expression in a $derived block does work: RPEL

Logs

No response

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13600KF
    Memory: 47.98 GB / 63.85 GB
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.11.0 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    svelte: 5.0.0-next.260 => 5.0.0-next.260

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions