-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Bug: lazy + hydrateRoot + sibling = mismatch #26181
Comments
|
I think this is caused by a missing Can you confirm this works for you? If that was indeed the cause, we should warn about a missing |
Yes, I see that fixes the issue in this case. This was an attempt to reproduce a bug I have in a larger, private repo. I'll keep tweaking it and see if I can create a better reproduction. |
OK, here we go. I think I've nailed the bug down this time and have a minimal repro that shows the issue, which is that lazy components with siblings that are NOT wrapped in suspense boundaries result in a hydration mismatch error. Repro: https://codepen.io/spudly_1470322188/pen/ZEMKEgY Steps To Reproduce
WorkaroundsAs best as I can tell, when you encounter this issue, you have 3 options:
Both the 1st and 2nd options change the render priority of the components in undesirable ways. The 1st changes high priority components to low priority, and the second changes low priority components to high priority. The third option is just not an option in real-world scenarios. |
@eps1lon , have a chance to review the updated repro? |
anybody? |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
I'm trying to use React' 18's new APIs to enable server-side suspense, but I'm getting hydration mismatch errors when I try to hydrate components that are wrapped in both
lazy()
and.<Suspense />
React version: 18.2.0
[EDIT] See updated description / repro below
## Steps To Reproduce- wrap a react component with
- server-side render it using
- try to hydrate it using
- look in dev console - notice errors
lazy
andSuspense
renderToPipeableStream
hydrateRoot
Link to code example: https://codesandbox.io/p/sandbox/dreamy-tristan-8ldu3o
The current behavior
Hydration fails with the following errors:
The expected behavior
Successful hydration / no errors
The text was updated successfully, but these errors were encountered: