From 052d5aa47468b88cd7100f6d921f00a95295d4b0 Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 21 May 2026 19:56:11 +0800 Subject: [PATCH] fix: colorPrimary cache cleared --- src/atoms/utils/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/atoms/utils/index.ts b/src/atoms/utils/index.ts index 5cb9391f..e9b64eb5 100644 --- a/src/atoms/utils/index.ts +++ b/src/atoms/utils/index.ts @@ -6,12 +6,17 @@ export const clearStorageUserSettings = () => { const savedSettings = JSON.parse( localStorage.getItem('userSettings') || '{}' ); + // colorPrimary is an enterprise-wide branding setting (set by admins + // and applied by `onAppInit` from /enterprise/settings), not a per-user + // preference. Preserve it across login — otherwise the next layout + // mount triggers `atomWithStorage.onMount`, re-reads localStorage, + // and falls back to the default color until a full page refresh + // re-runs `applyEnterpriseSettings`. localStorage.setItem( 'userSettings', JSON.stringify({ ...savedSettings, - hideAddResourceModal: false, - colorPrimary: undefined + hideAddResourceModal: false }) ); } catch (error) {