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

Error: Hydration failed because the initial UI does not match what was rendered on the server. #7

Open
hensansi opened this issue Sep 14, 2023 · 1 comment

Comments

@hensansi
Copy link

hensansi commented Sep 14, 2023

I was only able to reproduce this issue using cypress,

(uncaught exception)Error: Hydration failed because the initial UI does not match what was rendered on the server.
(uncaught exception)Error: Hydration failed because the initial UI does not match what was rendered on the server.
(uncaught exception)Error: Hydration failed because the initial UI does not match what was rendered on the server.

Warning: Expected server HTML to contain a matching <script> in <head>.

See more info here: https://nextjs.org/docs/messages/react-hydration-error
(uncaught exception)Error: Hydration failed because the initial UI does not match what was rendered on the server.

Warning: Expected server HTML to contain a matching <script> in <head>.

See more info here: https://nextjs.org/docs/messages/react-hydration-error
(uncaught exception)Error: There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.

Moving <ColorSchemeScript /> inside the body tag solves the issue but I have no idea if that is the correct solution.
Removing the const metadata solves the issue too but not ideal.

https://nextjs.org/docs/app/api-reference/components/script
https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#step-3-migrating-nexthead

If needed I can try to create a basic cypress test to show the issue but it will take some time.

irevdev pushed a commit to rvise-au/rvise-ui-library that referenced this issue Mar 27, 2024
@trixobird
Copy link

any update here from any official source? This is happening to me in dev (not cypress). NextJs is the goto framework so it seems important to have it working without any issues out of the box

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

2 participants