Skip to content

Async derived Promise.all over remote-query-like thenables loops forever #18662

Description

@kenkunz

Describe the bug

Requires compilerOptions.experimental.async: true.

Awaiting multiple async resource together with Promise.all:

const [a, b, c] = $derived(await Promise.all([one(), two(), three()]));

…re-executes the underlying work without bound instead of settling.

Inside a <svelte:boundary> it eventually crashes with effect_update_depth_exceeded; without one, it silently re-executes forever in the background.

It does not reproduce on a bare, first-ever mount(). It requires the component to be reached either via hydration or a reactive swap of siblings within an already-mounted tree (as SvelteKit's client-side router does on-navigation).

I hit this in a real app via SvelteKit's remote-functions: three queries awaited together via Promise.all on a page. It worked on a non-hydrating SSR-only load but hung/crashed on every client-side navigation to it. In my experience both in real code and the repro, it typically doesn't occur with 2 parallel awaited resources, but does with 3 or more.

I was able to repro in vanilla Svelte by mirroring the following two properties of remote functions:

  1. a then backed by a lazily-started reactive promise
  2. a value re-applied via .set(...) shortly after it resolves (single-flight refresh – a query response also carries a fresh copy of the query's own result).

Reproduction

Playground: Async derived Promise.all over remote-query-like thenables

  1. Load playground page
  2. Click "Navigate"
  3. Observe:
    • expected: button replaced by pending…, then content in Queries.svelte after 350ms
    • actual: hangs for ~5-7s, then displays crash message from failed snippet:
      Crashed: effect_update_depth_exceeded Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state https://svelte.dev/e/effect_update_depth_exceeded
      
    • console shows 3k messages representing 1k loops before update depth exceeded

Logs

effect_update_depth_exceeded
Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
https://svelte.dev/e/effect_update_depth_exceeded

System Info

System:
    OS: macOS 26.6.1
    CPU: (18) arm64 Apple M5 Pro
    Memory: 3.47 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.16.0 - /Users/ken/.local/state/fnm_multishells/2425_1786199624106/bin/node
    npm: 11.13.0 - /Users/ken/.local/state/fnm_multishells/2425_1786199624106/bin/npm
    pnpm: 11.5.3 - /Users/ken/.local/state/fnm_multishells/2425_1786199624106/bin/pnpm
  Browsers:
    Chrome: 151.0.7922.138
    Firefox: 153.0.4
    Safari: 26.6

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