-
Notifications
You must be signed in to change notification settings - Fork 134
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
Comments
New modifications
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 |
I ran into the same problem today, but I am using Next.js v15 with React 19 and implemented Mantine in my own template. I used this template to look up things. For any reason the in the Nevertheless the e2e tests after build would continue failing. Thanks to a comment on another issue by the wonderful cypress team I found a solution. Just wrap the import '@mantine/core/styles.css';
import React, { Suspense } from 'react';
import { ColorSchemeScript, MantineProvider } from '@mantine/core';
import { theme } from '../theme';
export const metadata = {
title: 'Mantine Next.js template',
description: 'I am using Mantine with Next.js!',
};
export default function RootLayout({ children }: { children: any }) {
return (
<html lang="en">
<head>
<Suspense>
<ColorSchemeScript />
</Suspense>
<link rel="shortcut icon" href="/favicon.svg" />
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, user-scalable=no"
/>
</head>
<body>
<MantineProvider theme={theme}>{children}</MantineProvider>
</body>
</html>
);
} |
Hey @sirPixieJerry Also downgraded react to version 18 to be able to install mantine. |
Agree. Afaik it does suppress all hydration warnings even if they are legit, doesn't it? |
Same problem here. I can also fix it by explicitly writing |
upgrading to mantine v7.15 (released 4h ago) and adding |
Yes, it has been updated in 7.15 release |
Thanks for your effort guys! 🙏 As I interpret the change, it still suppresses all hydration warnings even if they are legit, right? Would you mind sharing your thoughts on that change? Don't get me wrong, I do appreciate your work, I'm just curious. 🙂 Thanks! |
I was only able to reproduce this issue using cypress,
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.
The text was updated successfully, but these errors were encountered: