Skip to content

regression: #await block does not resolve Promise from +page.server.ts if loader contains another await #14496

@firatciftci

Description

@firatciftci

Describe the bug

I have a page whose +page.server.ts contains two calls to my database; one to get SEO data to be used inside <svelte:head>, and another to be displayed on the page. The former is awaited inside the loader function, returning just a string, which is then passed along to the client/SSR. The latter, though, is not awaited inside the loader, and so its promise is passed along to the +page.svelte file to be awaited inside an {#await} block. Starting with SvelteKit version 2.37.1 (probably after this PR: #14298), there appears to be a regression where the {#await} block (almost) never resolves the promise on +page.svelte; this could be a race condition, as the promise is rarely resolved, but 9 times out of 10, the loading state inside the {#await} block simply hangs.

If you remove the awaited function call inside the +page.server.ts file (and thus returning only the Promise data), then the issue goes away, but I have my whole application set up in this exact manner, so doing this is not a workaround/fix that I can apply.

Reproduction

Create a +page.svelte file that is set up to read the data from $props(); data.seo is passed inside relevant SEO fields inside <svelte:head> directly, and data.items is a Promise that is to be resolved inside an {#await} block, whose content will be displayed on the page.

The former step should work properly (i.e., the <title>, etc. should update accordingly), but the latter step should never resolve (9 times out of 10).

Logs

System Info

System:
    OS: macOS 26.0
    CPU: (14) arm64 Apple M4 Pro
    Memory: 115.22 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.19.0 - ~/.local/state/fnm_multishells/10602_1758321273340/bin/node
    npm: 11.6.0 - ~/.local/state/fnm_multishells/10602_1758321273340/bin/npm
    pnpm: 10.17.0 - ~/Library/pnpm/pnpm
    bun: 1.2.20 - ~/.bun/bin/bun
    Watchman: 2025.09.08.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 140.0.7339.134
    Safari: 26.0
  npmPackages:
    @sveltejs/adapter-node: ^5.3.2 => 5.3.2
    @sveltejs/kit: ^2.42.2 => 2.42.2
    @sveltejs/vite-plugin-svelte: ^6.2.0 => 6.2.0
    rolldown-vite:  7.1.11
    svelte: ^5.39.3 => 5.39.3

Severity

blocking all usage of SvelteKit

Additional Information

No response

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