Skip to content

Commit 4b32588

Browse files
committed
Fix white flash in Next Pages Dir
1 parent 5ad31f1 commit 4b32588

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/next-pagesdir.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ import { start } from "./start";
2020
import type { RegisterLink, RegisteredLinkProps } from "./link";
2121
import { setLink } from "./link";
2222
import { setUseLang } from "./i18n";
23-
import Script from "next/script";
2423
import { assert } from "tsafe/assert";
2524
import "./assets/dsfr_plus_icons.css";
2625

26+
const isProduction = process.env.NODE_ENV !== "development";
27+
2728
export type { RegisterLink, RegisteredLinkProps };
2829

2930
export type CreateNextDsfrIntegrationApiParams = {
@@ -175,11 +176,13 @@ export function createNextDsfrIntegrationApi(
175176
/>
176177
</>
177178
)}
178-
<Script
179-
dangerouslySetInnerHTML={{
180-
"__html": getScriptToRunAsap(defaultColorScheme)
181-
}}
182-
/>
179+
{isProduction && (
180+
<script
181+
dangerouslySetInnerHTML={{
182+
"__html": getScriptToRunAsap(defaultColorScheme)
183+
}}
184+
/>
185+
)}
183186
</Head>
184187
{isBrowser ? (
185188
<App {...(props as any)} />

0 commit comments

Comments
 (0)