`browser.hydrate: false` breaks client-side router
See original GitHub issueDescribe the bug
Setting browser.hydrate to false renders the client-side router unusable whilst not disabling it. This results in the following behaviour:
- Link gets clicked
- URL in address bar changes
- Content of page stays unchanged
Setting export const hydrate = false on a page does interestingly not break the router.
Reproduction
- Start the dev server and click on the links to observe the broken router
- Comment the
browser: { hydrate: false },line insvelte.config.jsand restart the dev server to see the router working again.
Logs
When clicking on link (browser console):
[HMR][Svelte] Unrecoverable HMR error in <Root>: next update will trigger a full reload
Uncaught (in promise) Error: options.hydrate only works if the component was compiled with the `hydratable: true` option
at Object.claim [as l] (root.svelte? [sm]:50:13)
at init (index.mjs:1883:40)
at new Root (root.svelte? [sm]:16:25)
at createProxiedComponent (svelte-hooks.js:341:9)
at new ProxyComponent (proxy.js:242:7)
at new Proxy<Root> (proxy.js:349:11)
at initialize (start.js:702:10)
at update (start.js:631:4)
at async navigate (start.js:1241:3)

System Info
System:
OS: Windows 10 10.0.19044
CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
Memory: 10.11 GB / 15.93 GB
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
npm: 8.3.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.36)
npmPackages:
@sveltejs/adapter-netlify: ^1.0.0-next.51 => 1.0.0-next.51
@sveltejs/kit: next => 1.0.0-next.299
svelte: ^3.46.4 => 3.46.4
Severity
serious, but I can work around it
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Debugging and fixing hydration issues - somewhat abstract
To exclude a component that needs layout effects from the server-rendered HTML, render it conditionally with showChild && <Child /> and defer ...
Read more >Client-Side Routing In Next.js - Smashing Magazine
Next.js has a file-based routing system in which each page automatically becomes a route based on its file name. This article will guide...
Read more >react-hydration-error - Next.js
In general this issue is caused by using a specific library or application code that is relying on something that could differ between...
Read more >Migrating Breaking Changes in SvelteKit - Netlify
SvelteKit has gone through a few breaking changes recently including an entire routing overhaul, changes to the load API, and a switch to ......
Read more >Sveltekit Braking changes: Routing, Load Function and new ...
This article going to explain all the breaking changes sveltekit just ... config.kit.browser.hydrate - export const router = true or false ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Uncaught (in promise) Error: options.hydrate only works if the component was compiled with the
hydratable: trueoption My app was working fine. Then I updated sveltekit to the latest version now it is giving this errorI ran into this by following the TailwindCSS docs, which instruct you to configure
svelte.config.jsthusly:The correct configuration is as so: