Uncaught Error: Hydration failed because the initial UI does not match what was rendered on the serv
Not happens on every site loading but I am just wondering how can I debug this error?
I tried removing everything from the component in
__root.tsx
. As long as <Script />
is here, the error can happen.
I know I don't provide a reproduction here but I am just looking for guesses if any or a way to have a clearer error message? ๐
The full error message is:
10 Replies
ugly-tanโข8mo ago
have you try using
suppressHydrationWarning
?flat-fuchsiaOPโข8mo ago
No luck
Tanstack Start v1.97.0
I'm so confused, the error can also appear if my __root file is only this:
The only way to make it work is to have a empty head:
like-goldโข8mo ago
Have you tried running your app on incognito? Sometimes this happen because of a chrome extension.
flat-fuchsiaOPโข8mo ago
Thank you for the help!!
I figured this happens only when using content-collection (
@content-collections/vite
package).
To reproduce:
1. https://github.com/ally-ahmed/tss-blog-starter
2. Install packages and run dev command
3. See the error on page load
4. Refresh and the error goes away
To reproduce it again, remove the vinxi cache and run it again you'll see the error on each first loadGitHub
GitHub - ally-ahmed/tss-blog-starter: A blog/portfolio starter proj...
A blog/portfolio starter project built with TanStack Start. - ally-ahmed/tss-blog-starter
flat-fuchsiaOPโข8mo ago
cc @Ahmed Ali ( ..)(..)(._. )
flat-fuchsiaOPโข8mo ago
content-collections maintainer is working on a Vinxi adapter hopefully this will fix it: https://github.com/sdorra/content-collections/issues/450
ambitious-aquaโข8mo ago
@Baptiste Just re-created this bug. Yeah it looks like it is content-collections. Thank you for narrowing it down. I know it can take same time and a lot of hair pulling trying to figure out the culprit.
ambitious-aquaโข8mo ago
@Baptiste Actually, the content-collections seems to think it is content-collections causing the hydration error. Let me confirm again.
Not sure if this tool is out but something like this will be really helpful https://x.com/aidenybai/status/1878498426704543906
flat-fuchsiaOPโข8mo ago
Omg yessss
I tried the new
vinxi
adapter the maintainer is working on: https://github.com/sdorra/content-collections/pull/458. It fixes the issue ๐ambitious-aquaโข8mo ago
@Baptiste The new update is breaking for me in prod. Could you please delete the
.content-collections
folder and try to build for prod. The .content-collections
folder is not being created automatically. Maybe I need to use the content-collections cli with concurrently https://content-collections-git-feature-450supporttanstackstart-nitilon.vercel.app/docs/quickstart/cliCLI
Setup guide for the Content Collections CLI