Svelte

hydration mismatch with async and nested if

#17618

Development PRs

Issue

Solved
S
santiagocezar
Feb 5, 2026, 3:48 AM

Describe the bug

Using a nested {#if}{/if} on an async component while having the experimental async feature enabled, breaks hydration when using SSR.

It seems like it fails to find the hydration markers, using whatever else it finds instead.

Reproduction

https://github.com/santiagocezar/hydration-troubles-repro

It seems to be a regression in 5.49.2. Plus, I checked if PR fixed it by chance but had no luck there, sadly.

There's three variants!

  • The sync one is the boring one that just works
  • The async-only one causes a hydration mismatch (but the error log doesn't give much details as to why)
  • The async+onclick one causes a completely different error! (it grabs a text node for some reason)

Logs

# on the Async-only variation
[svelte] hydration_mismatch
Hydration failed because the initial UI does not match what was rendered on the server
https://svelte.dev/e/hydration_mismatch
Uncaught (in promise) Object {  }

# on the Async+onclick one
Uncaught (in promise) DOMException: Node.appendChild: Cannot add children to a Text

System Info

System:
    OS: Linux 6.18 cpe:/o:nixos:nixos:26.05 26.05 (Yarara)
    CPU: (16) x64 AMD Ryzen 7 7730U with Radeon Graphics
    Memory: 4.65 GB / 14.98 GB
    Container: Yes
    Shell: 0.109.1 - /run/current-system/sw/bin/nu
  Binaries:
    Node: 24.13.0 - /run/current-system/sw/bin/node
    npm: 11.6.2 - /run/current-system/sw/bin/npm
    pnpm: 10.28.0 - /run/current-system/sw/bin/pnpm
    bun: 1.3.6 - /run/current-system/sw/bin/bun
  Browsers:
    Firefox: 147.0.1
    Firefox Developer Edition: 147.0.1
  npmPackages:
    svelte: 5.49.2 => 5.49.2

Severity

blocking an upgrade

👍 1

Info

Closed at Feb 6, 2026, 3:54 PM
Assignees None
Labels None
Milestone None

Pro tip: You can prefix GitHub URLs of issues, PRs or discussions with svcl.dev/ to view them on this page! Also try it on a GitHub release ;)