diff --git a/components/mobile/profile/ThemeSessionBridge.tsx b/components/mobile/profile/ThemeSessionBridge.tsx index 0acc135..5e5b3c4 100644 --- a/components/mobile/profile/ThemeSessionBridge.tsx +++ b/components/mobile/profile/ThemeSessionBridge.tsx @@ -32,7 +32,14 @@ export function ThemeSessionBridge() { setTheme(serverTheme); } } - }, [session?.user, theme, setTheme]); + // Deps intentionally exclude `theme`. This bridge syncs server → client + // on session establishment only. Including `theme` made the effect re-fire + // on every user selection and revert to the stale cached + // `session.user.theme` (the PUT to /api/me/theme does not refresh the + // better-auth session, so user.theme remains the pre-change value and + // "wins" against the new client value). + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [session?.user?.id, setTheme]); return null; }