Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hydration Mismatch error #2132

Open
PeterDraex opened this issue Apr 16, 2024 · 6 comments
Open

Hydration Mismatch error #2132

PeterDraex opened this issue Apr 16, 2024 · 6 comments

Comments

@PeterDraex
Copy link

Describe the bug

Getting an error:

Error: Hydration Mismatch. Unable to find DOM nodes for hydration key: s00-0-0-0-0-0-0-0-0-1-3

Your Example Website or App

https://stackblitz.com/edit/github-pqy8j7-jhayd9?file=src%2Fcomponents%2FPage.tsx

Steps to Reproduce the Bug or Issue

  1. Open console
  2. See Hydration Mismatch Error

Expected behavior

Blank page is displayed, with no errors in console.

Screenshots or Videos

No response

Platform

Windows, Chrome 123

Additional context

No response

@elite174
Copy link
Contributor

@PeterDraex
Copy link
Author

PeterDraex commented Apr 18, 2024

This was solved here: https://discord.com/channels/722131463138705510/1229910798135066716/1230151418569298052

Yeah, a workaround of deferStream: true was suggested on Discord (thank you). Another available workaround is using <Show> instead of <Switch>.

The issue seems to be that as soon as Switch matches a case it renders and flushes the data. So in this case when pending case is matched it renders that and then yields.

@indeyets
Copy link

it works a bit different with solid-query 5.29:

  1. seems to reach success-state
  2. but still shows Hydration Mismatch in console

@indeyets
Copy link

attn @ardeora

@ryansolid
Copy link
Member

It's pretty hard for me to debug Solid Query stuff. Like I need to put time aside to get into the code base. It might be easiest to report bugs against them and then they make reproductions with pure createResource so I can better see what is going on without tracing through that code.

@ardeora
Copy link

ardeora commented Apr 26, 2024

It's pretty hard for me to debug Solid Query stuff. Like I need to put time aside to get into the code base. It might be easiest to report bugs against them and then they make reproductions with pure createResource so I can better see what is going on without tracing through that code.

Apologies @ryansolid Here is an example with just using createResource.
https://stackblitz.com/edit/github-pqy8j7-n87wnf?file=src%2Fcomponents%2FPage.tsx

I think the Switch component (during SSR) eagerly evaluates and flushes the data when any case matches? In this case you would always see the pending string in the HTML after hydration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants