diff --git a/src/api/branding.ts b/src/api/branding.ts index 8dfc21c..2073e8c 100644 --- a/src/api/branding.ts +++ b/src/api/branding.ts @@ -46,25 +46,32 @@ export const isLogoPreloaded = (): boolean => { } }; -// Get cached branding from localStorage +// Get cached branding from sessionStorage export const getCachedBranding = (): BrandingInfo | null => { try { - const cached = localStorage.getItem(BRANDING_CACHE_KEY); + const cached = sessionStorage.getItem(BRANDING_CACHE_KEY); if (cached) { return JSON.parse(cached); } + // One-time migration: move stale localStorage value to sessionStorage + const legacy = localStorage.getItem(BRANDING_CACHE_KEY); + if (legacy) { + localStorage.removeItem(BRANDING_CACHE_KEY); + sessionStorage.setItem(BRANDING_CACHE_KEY, legacy); + return JSON.parse(legacy); + } } catch { - // localStorage not available or invalid JSON + // storage not available or invalid JSON } return null; }; -// Update branding cache in localStorage +// Update branding cache in sessionStorage export const setCachedBranding = (branding: BrandingInfo) => { try { - localStorage.setItem(BRANDING_CACHE_KEY, JSON.stringify(branding)); + sessionStorage.setItem(BRANDING_CACHE_KEY, JSON.stringify(branding)); } catch { - // localStorage not available + // sessionStorage not available } }; diff --git a/src/components/layout/AppShell/AppHeader.tsx b/src/components/layout/AppShell/AppHeader.tsx index 84d6ee0..1ff846d 100644 --- a/src/components/layout/AppShell/AppHeader.tsx +++ b/src/components/layout/AppShell/AppHeader.tsx @@ -93,6 +93,7 @@ export function AppHeader({ return data; }, initialData: getCachedBranding() ?? undefined, + initialDataUpdatedAt: 0, staleTime: 60000, refetchOnWindowFocus: true, retry: 1, diff --git a/src/components/layout/AppShell/Aurora.tsx b/src/components/layout/AppShell/Aurora.tsx index 7cbd365..278f70f 100644 --- a/src/components/layout/AppShell/Aurora.tsx +++ b/src/components/layout/AppShell/Aurora.tsx @@ -127,7 +127,30 @@ function generateColorStops(background: string, surface: string, accent: string) return [background, surface, dimAccent(accent)]; } +let _webglAvailable: boolean | null = null; + +function isWebglAvailable(): boolean { + if (_webglAvailable === null) { + try { + const renderer = new Renderer({ + alpha: true, + antialias: false, + powerPreference: 'low-power', + }); + _webglAvailable = !!renderer.gl; + } catch { + _webglAvailable = false; + } + } + return _webglAvailable; +} + export function Aurora() { + if (!isWebglAvailable()) return null; + return ; +} + +function AuroraImpl() { const containerRef = useRef(null); const animationFrameRef = useRef(0); const rendererRef = useRef(null); diff --git a/src/components/layout/AppShell/DesktopSidebar.tsx b/src/components/layout/AppShell/DesktopSidebar.tsx index 2f826a5..8f36328 100644 --- a/src/components/layout/AppShell/DesktopSidebar.tsx +++ b/src/components/layout/AppShell/DesktopSidebar.tsx @@ -62,6 +62,7 @@ export function DesktopSidebar({ return data; }, initialData: getCachedBranding() ?? undefined, + initialDataUpdatedAt: 0, staleTime: 60000, refetchOnWindowFocus: true, retry: 1, diff --git a/src/hooks/useBranding.ts b/src/hooks/useBranding.ts index c827ea4..125ab15 100644 --- a/src/hooks/useBranding.ts +++ b/src/hooks/useBranding.ts @@ -27,6 +27,7 @@ export function useBranding() { return data; }, initialData: getCachedBranding() ?? undefined, + initialDataUpdatedAt: 0, staleTime: 60000, enabled: isAuthenticated, }); diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 2f27756..edc9e53 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -90,6 +90,7 @@ export default function Login() { }, staleTime: 60000, initialData: cachedBranding ?? undefined, + initialDataUpdatedAt: 0, }); // Check if email auth is enabled