Skip to content

hydration_mismatch when pending snippet is passed as prop to <svelte:boundary> #16886

@Tinggaard

Description

@Tinggaard

Describe the bug

hydration_mismatch error shows up when passing the pending snippet as a prop to <svelte:boundary> instead of as a child.

I.e. this works

<svelte:boundary>
  {@const _ = await new Promise((r) => setTimeout(r, 2000))}
  <p>Content has now loaded</p>

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

While this does not

{#snippet pending()}
  loading...
{/snippet}

<svelte:boundary {pending}>
  {@const _ = await new Promise((r) => setTimeout(r, 2000))}
  <p>Content has now loaded</p>
</svelte:boundary>

Furthermore. The latter briefly shows undefined right after the pending snippet, which quickly disappears again.

Reproduction

https://stackblitz.com/github/tinggaard/boundary-pending-prop

Logs

[svelte] hydration_mismatch

System Info

System:
    OS: Linux 6.16 Arch Linux
    CPU: (16) x64 AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
    Memory: 14.68 GB / 27.15 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.8.0 - /usr/bin/node
    npm: 11.6.1 - /usr/bin/npm
    pnpm: 10.17.1 - /usr/bin/pnpm
  Browsers:
    Brave Browser: 139.1.81.137
    Chromium: 140.0.7339.207
  npmPackages:
    @sveltejs/adapter-auto: ^6.1.1 => 6.1.1
    @sveltejs/kit: 2.43.8 => 2.43.8
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
    svelte: ^5.39.8 => 5.39.8
    vite: ^7.1.9 => 7.1.9

Severity

annoyance

Additional Information

No response

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