svelte: Svelte 5 Hydration mismatch (with adapter-static)
Describe the bug
Using Svelte 5 with my unchanged (working) Svelte(Kit) Application throws an error.
Not sure how to explain what happens, but a clue could be that I use adapter static?
Reproduction
I dont have the time at the moment to produce a clean reproduction scenario, hopefully there are enough clues from the screenshot. Maybe I just needed to update some of the related packages?
Logs
[svelte] hydration_mismatchHydration failed because the initial UI does not match what was rendered on the server
warn @ client.js:2578
hydration_mismatch @ warnings.js:28
hydrate @ render.js:171
Svelte4Component @ legacy-client.js:75
(anonymous) @ legacy-client.js:47
initialize @ client.js:409
navigate @ client.js:1350
await in navigate (async)
_goto @ client.js:353
goto @ client.js:1672
start @ client.js:284
(anonymous) @ t26793:27
Promise.then (async)
(anonymous) @ t26793:26
Show 10 more frames
Show less
operations.js:213 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'call')
at clear_text_content (operations.js:213:19)
at hydrate (render.js:173:4)
at new Svelte4Component (legacy-client.js:75:49)
at new <anonymous> (legacy-client.js:47:4)
at initialize (client.js:409:9)
at navigate (client.js:1350:3)
System Info
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"autoprefixer": "^10.4.14",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"postcss": "^8.4.25",
"postcss-cli": "^10.1.0",
"postcss-html": "^1.5.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"run-p": "^0.0.0",
"standard-version": "9.5.0",
"stylelint": "^16.0.2",
"stylelint-config-css-modules": "^4.4.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-config-tailwindcss": "^0.0.7",
"svelte": "^5.0.0-next.123",
"svelte-check": "^3.6.0",
"svelte-preprocess": "^5.0.3",
"tailwindcss": "^3.4.1",
"terser": "^5.25.0",
"typescript": "5.1.3",
"vite": "^5.0.3",
"vite-plugin-mkcert": "^1.13.3"
},
Severity
blocking an upgrade
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (8 by maintainers)
UPDATE:
Turns out, Bun was caching old files. I’m no longer getting the errors after forcefully and manually removing all traces of cache and reinstalling packages.
So if you continue to have these errors, give deep cleaning of cache a try.
If you render you app without SSR, does that error go away?