fix(ui): stop settings save echoes from clobbering theme preferences
Every updateDesktopSettings PUT replays the server's full settings document as an openchamber:settings-synced event, and the theme listener adopted it unconditionally - so switching sessions across directories (any lastDirectory/activeProjectId write) could flip the theme to whatever the server document held at that moment. A bootstrap GET with missing theme fields made it worse: materializeAuthoritativeUiSettings invented useSystemTheme + openchamber defaults and the persist effect wrote them back to the server and the scoped localStorage entry. Theme is now adopted only from bootstrap-grade syncs (the renamed bootstrap flag, formerly adoptWorkspace), missing fields mean 'not set' and keep the current preference, and the materializer no longer invents theme defaults. Cross-window same-instance theme sync still rides the scoped-key storage event; runtime endpoint switches still adopt the new instance's server theme. Closes the 'theme flashes to OpenChamber when switching sessions' report; same family as the pre-#2897 'color mode forced to light' symptom.
This commit is contained in:
@@ -602,7 +602,7 @@ export const SessionAuthGate: React.FC<SessionAuthGateProps> = ({
|
||||
hasBootstrapResyncedRef.current = true;
|
||||
void (async () => {
|
||||
await initializeAppearancePreferences();
|
||||
await syncDesktopSettings({ adoptWorkspace: isBootstrapResync });
|
||||
await syncDesktopSettings({ bootstrap: isBootstrapResync });
|
||||
if (isBootstrapResync) {
|
||||
await applyPersistedDirectoryPreferences();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user