From b82a5d463346deb5c3f190a1488b254596e2764c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 23 May 2026 02:54:10 -0400 Subject: [PATCH] fix: prevent flash of light theme on marketplace load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add inline script to root layout that reads the stored theme preference from cookie/localStorage synchronously before React hydrates, eliminating the light→dark flash for users who prefer dark mode. Also guard the theme storage write with the hydrated flag so the initial render does not overwrite a stored 'dark' preference with 'light'. Co-Authored-By: Claude Sonnet 4.6 --- apps/marketplace/src/app/layout.tsx | 8 ++++++++ apps/marketplace/src/components/MarketplaceShell.tsx | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/marketplace/src/app/layout.tsx b/apps/marketplace/src/app/layout.tsx index 470c91e..977c398 100644 --- a/apps/marketplace/src/app/layout.tsx +++ b/apps/marketplace/src/app/layout.tsx @@ -17,6 +17,14 @@ export default function RootLayout({ children }: { children: React.ReactNode }) const language = getMarketplaceLanguage() return ( + + {/* Runs before hydration to prevent flash of wrong theme */} +