Closed
Description
Describe the bug
When certain component is SSR-ed, I get a type error during hydration (see logs section). Minimal reproduction I could make looks like this:
<script>
let { name, remaining } = $props();
</script>
<span>
<span>{name}</span>{remaining >= 2 ? ',' : ''}
</span>
The problem is caused by spacing between </span>
and {
. When I make the following change, the error no longer occurs:
- <span>{name}</span>{remaining >= 2 ? ',' : ''}
+ <span>{name}</span> {remaining >= 2 ? ',' : ''}
This crash causes Svelte to remove everything from DOM. Page that was server rendered not only isn't hydrated, but just goes blank.
Reproduction
Failing test: https://github.com/jrmajor/svelte/tree/c659c94d16a7306848935ff4ed11a4b4bb091873/packages/svelte/tests/hydration/samples/strange-spacing
Commit with tests to cherry pick: jrmajor@c659c94
Logs
Uncaught (in promise) TypeError: can't access property "nodeType", next_sibling is null
in MainCredits.svelte
in Show.svelte
in Render.svelte
in Layout.svelte
in Render.svelte
in App.svelte
sibling operations.js:166
ArtistName ArtistName.svelte:74
effect2 hmr.js:47
update_reaction runtime.js:318
update_effect runtime.js:444
create_effect effects.js:125
branch effects.js:346
wrapper hmr.js:38
update_reaction runtime.js:318
update_effect runtime.js:444
System Info
System:
OS: macOS 15.0
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 514.17 MB / 16.00 GB
Shell: 3.7.1 - /usr/local/bin/fish
Binaries:
Node: 23.1.0 - /usr/local/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.9.0 - /usr/local/bin/npm
pnpm: 9.12.3 - /usr/local/bin/pnpm
bun: 1.1.34 - /usr/local/bin/bun
Browsers:
Safari: 18.0
npmPackages:
svelte: ^5.2 => 5.2.0
Severity
blocking all usage of svelte