You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am not sure if this is true for others, but I've seen this hydration warning in every project I've scaffolded with kirimase so far. I've been meaning to track down the bug and finally got some time.
Seems the NextThemesProvider is causing the hydration mismatch. The fix I found for it was to dynamically import the component and seems to work on my end. Wanted to share the solution for anyone else facing the same issue. Here's my the commit from my repo where I made the change.
Expected behavior
Should not cause hydration issues on a new scaffold.
Screenshots
Desktop (please complete the following information):
OS: [MacOS Sonoma]
Browser [arc, safari]
The text was updated successfully, but these errors were encountered:
From what I understand this is try this does opt the entire tree below this point which is the entire application. So this made me look for a diff solution, which I found on the next-themes github issue.
Simply adding the suppressHydrationWarning prop at least disables the message. The prop gets added to the html element in layout.tsx:
exportdefaultfunctionRootLayout({
children,}: Readonly<{children: React.ReactNode;}>){return(<htmllang="en"suppressHydrationWarning>{/* add the prop here */}<bodyclassName={GeistSans.className}><Providers><ThemeProviderattribute="class"defaultTheme="system"enableSystemdisableTransitionOnChange>{children}</ThemeProvider></Providers></body></html>);}
Config File
Describe the bug
I am not sure if this is true for others, but I've seen this hydration warning in every project I've scaffolded with kirimase so far. I've been meaning to track down the bug and finally got some time.
Seems the NextThemesProvider is causing the hydration mismatch. The fix I found for it was to dynamically import the component and seems to work on my end. Wanted to share the solution for anyone else facing the same issue. Here's my the commit from my repo where I made the change.
Expected behavior
Should not cause hydration issues on a new scaffold.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: