Merge pull request #208 from ArnasDon/fix/theme-hydration-warning

fix(theme): suppress hydration warning on root html data-theme (#207)
This commit is contained in:
Arnas Donauskas 2026-06-05 14:14:57 +03:00 committed by GitHub
commit 75ff74730f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,6 +70,13 @@ export default function RootLayout({
lang="en"
data-theme={DEFAULT_THEME}
className={`${inter.variable} h-full antialiased`}
// The `theme-boot` script below rewrites `data-theme` on <html>
// from localStorage before React hydrates, so for any non-default
// theme the client DOM intentionally differs from the server-
// rendered `DEFAULT_THEME`. suppressHydrationWarning silences the
// expected mismatch — it only applies to this element's own
// attributes, so genuine mismatches in children still surface.
suppressHydrationWarning
>
<head>
<Script