-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Describe the bug
Under certain conditions, hydration appends elements to the DOM alongside prerendered parts, leading to element duplication. This seems to specifically affect routes/components using svelte:head
and depends heavily on components’ structure. There is no duplication after navigating away and coming back.
This behaviour is almost certainly introduced by a recent change in Svelte, but it doesn’t seem to affect much beyond SvelteKit (obviously not REPL, but also not Sapper), so may warrant a look at this side.
To Reproduce
Clone and run the demo: https://github.com/intrikate/sveltekit-duplication-issue.
Expected behavior
CSR should overwrite, not duplicate, SSR.
Information about your SvelteKit Installation:
Diagnostics
System:
OS: macOS 11.2.3
CPU: (4) x64 Intel(R) Core(TM) i5-4288U CPU @ 2.60GHz
Memory: 130.07 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.11 - /usr/local/bin/npm
Browsers:
Chrome: 90.0.4430.93
Firefox Developer Edition: 89.0
Safari: 14.0.3
npmPackages:
@sveltejs/kit: next => 1.0.0-next.94
svelte: ^3.38.0 => 3.38.0
vite: ^2.2.3 => 2.2.3
Severity
High.