Skip to content

Commit e7796da

Browse files
committed
fix: initialize theme before paint
1 parent 869a7f1 commit e7796da

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/app/layout.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ export default function RootLayout({children}: {children: React.ReactNode}) {
163163
return (
164164
<html lang={siteConfig.languageCode} dir={siteConfig.isRTL ? 'rtl' : 'ltr'}>
165165
<head>
166+
<script
167+
id="theme-init"
168+
dangerouslySetInnerHTML={{__html: themeScript}}
169+
/>
166170
{/* RSS autodiscovery */}
167171
<link
168172
rel="alternate"
@@ -205,11 +209,6 @@ export default function RootLayout({children}: {children: React.ReactNode}) {
205209
)}
206210
</head>
207211
<body className="font-text font-medium antialiased text-lg bg-wash dark:bg-wash-dark text-secondary dark:text-secondary-dark leading-base">
208-
<Script
209-
id="theme-init"
210-
strategy="beforeInteractive"
211-
dangerouslySetInnerHTML={{__html: themeScript}}
212-
/>
213212
<ScrollRestoration />
214213
<AnalyticsTracker />
215214
{children}

0 commit comments

Comments
 (0)