Suppress spurious dark mode hydration warnings on the web app

This is triggered by mismatch between "dark" class present on server
sent layout but not in client sent layout on initial render.

That mismatch exists because the server applies dark-mode styling
early to avoid FOUC flickering of UX.

Related 43e032e
This commit is contained in:
Debanjum
2025-04-09 09:02:57 +05:30
parent 9ab5ead3ca
commit e9ee9004fb

View File

@@ -48,7 +48,11 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en" className={`${noto_sans.variable} ${noto_sans_arabic.variable}`}>
<html
lang="en"
className={`${noto_sans.variable} ${noto_sans_arabic.variable}`}
suppressHydrationWarning
>
<head>
<script
dangerouslySetInnerHTML={{
@@ -65,9 +69,7 @@ export default function RootLayout({
</head>
<ContentSecurityPolicy />
<body>
<ThemeProvider>
{children}
</ThemeProvider>
<ThemeProvider>{children}</ThemeProvider>
</body>
</html>
);