Experimental Option: Rendering instead of Hydrate #42115
Unanswered
deve-sh
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The Perils of Hydration
When building isomorphic React apps, we've all encountered this error at least once:
Most of the time, it's just a warning that can be ignored. But sometimes, it causes major UI breaks.
A great post on this issue: https://www.joshwcomeau.com/react/the-perils-of-rehydration/
Pages with dynamic content, that are static for speed, but have content that can change during rendering face this problem very often.
Suggestion: An Experimental flag like
renderInsteadOfHydrate
to alwaysrender
the app instead ofhydrate
on the clientHydration does have performance benefits of course during the first render, as it's expected that the UI would be very similar on the client to that on the server, and due to that, it can find existing DOM Nodes quickly.
But for pages that are not very large, rendering and hydrating would not have a lot of performance difference.
Hence an experimental flag for apps that understand that trade-off, and are in need of this use case would help significantly:
Pull Request as an Example
I've created a sample Pull Request for the above here: https://github.com/deve-sh/next.js/pull/1/files
Let me know what you guys think.
Beta Was this translation helpful? Give feedback.
All reactions