From 2a3e89c753eb8de14ca4f3933a645f2939ef8bb3 Mon Sep 17 00:00:00 2001 From: lorentz Date: Sun, 10 May 2026 21:54:04 -0400 Subject: [PATCH] fix(09): ThemeSessionBridge ignores server 'system' to preserve existing client theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migration 084 backfilled theme='system' for all existing users. The bridge was then calling setTheme('system') on every signed-in client, clobbering existing localStorage values (e.g. user previously chose 'dark', got reset to OS preference). Treat server 'system' as 'no explicit opinion' — only enforce explicit 'light'/'dark' from the server. Tradeoff: explicit 'system' selection on one device won't propagate to a device that has 'light'/'dark' cached. Acceptable — users can re-select. --- components/mobile/profile/ThemeSessionBridge.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/mobile/profile/ThemeSessionBridge.tsx b/components/mobile/profile/ThemeSessionBridge.tsx index 3c5ce88..0acc135 100644 --- a/components/mobile/profile/ThemeSessionBridge.tsx +++ b/components/mobile/profile/ThemeSessionBridge.tsx @@ -23,11 +23,11 @@ export function ThemeSessionBridge() { useEffect(() => { if (!session?.user) return; const serverTheme = (session.user as SessionUserWithTheme).theme; - if ( - serverTheme === 'light' || - serverTheme === 'dark' || - serverTheme === 'system' - ) { + // Only enforce explicit choices. 'system' is the column default and may + // mean "no opinion yet" — don't clobber a user's existing client preference + // (especially relevant on first load after the migration that backfilled + // every existing user to 'system'). + if (serverTheme === 'light' || serverTheme === 'dark') { if (serverTheme !== theme) { setTheme(serverTheme); }