[Bug?]: Client Only component displayed in app.tsx causes hydration errors
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 426
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 11
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
If a client only component is added in app.tsx and when the matching route suspends then a hydration mismatch error is caused.
Expected behavior 🤔
There should be no hydration mismatch error when including a client only component anywhere in the app
Steps to reproduce 🕹
Steps:
- Open https://stackblitz.com/edit/github-hn2yqi?file=src%2Froutes%2Findex.tsx
- Reload the page
- Wait for 1 second and notice a hydration mismatch error
- If you set the variable
perform_hydration_errorto false then you shall see the hydration error disappear - This is because setting
perform_hydration_errorto false prevents the matching route in index.tsx from suspending
Context 🔦
I am a maintainer of TanStack Solid Query. I found this error because I wanted to create the hackernews demo using SolidStart and SolidQuery. Adding the SolidQueryDevtools that are only supposed to run on the client was breaking the app. Any ideas here would be greatly appreciated 🙏
Your environment 🌎
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the linked StackBlitz example, starting with src/routes/index.tsx and the client-only component added in app.tsx. Compare behavior with perform_hydration_error enabled and disabled while the matching route suspends. Done means the route can suspend with the client-only component present without producing a hydration mismatch error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100