The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): repaint peer windows when the appearance changes
Brooklyn Nicholson67518a2adf10
diff --git a/apps/desktop/src/themes/context.tsx b/apps/desktop/src/themes/context.tsxindex e618534c310..20915938b76 100644--- a/apps/desktop/src/themes/context.tsx+++ b/apps/desktop/src/themes/context.tsx@@ -69,6 +69,9 @@ const profilePref = <T extends string>(record: string, legacy: string, normalizeexport const skinPref = profilePref(PROFILE_SKINS_KEY, SKIN_KEY, normalizeSkin)export const modePref = profilePref(PROFILE_MODES_KEY, MODE_KEY, normalizeMode)+/** Everything a peer window could change that this one has to repaint for. */+const APPEARANCE_KEYS = new Set([SKIN_KEY, PROFILE_SKINS_KEY, MODE_KEY, PROFILE_MODES_KEY])+// Last active profile — lets the boot paint pick its appearance before the// gateway reports which profile actually launched.const readBootProfileKey = () => normalizeProfileKey(storedString(LAST_PROFILE_KEY))@@ -351,6 +354,27 @@ export function ThemeProvider({ children }: { children: ReactNode }) {setModeState(modePref.resolve(profileKey))}, [profileKey])+ // Appearance is per-profile localStorage, and every desktop window is another+ // renderer on the same origin — so a switch made in the HUD (or any peer+ // window) only ever repainted the window it was made in. `storage` fires in+ // the OTHER windows, which is exactly the set that needs to catch up.+ useEffect(() => {+ const onStorage = (event: StorageEvent) => {+ if (event.key && !APPEARANCE_KEYS.has(event.key)) {+ return+ }++ const live = normalizeProfileKey($activeGatewayProfile.get())++ setThemeNameState(skinPref.resolve(live))+ setModeState(modePref.resolve(live))+ }++ window.addEventListener('storage', onStorage)++ return () => window.removeEventListener('storage', onStorage)+ }, [])+const systemDark = useMediaQuery('(prefers-color-scheme: dark)')const resolvedMode = resolveMode(mode, systemDark)