mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
fix: move cabinet_branding to sessionStorage and add WebGL availability check
- Branding cache moved from localStorage to sessionStorage so it clears when the mini-app is closed, preventing stale names after admin updates - Added initialDataUpdatedAt: 0 to all branding queries so fresh data is always fetched on page refresh while showing cached data instantly - One-time migration moves existing localStorage value to sessionStorage - Aurora component now checks WebGL availability upfront, skipping all hooks and subscriptions when WebGL is not supported
This commit is contained in:
@@ -93,6 +93,7 @@ export function AppHeader({
|
||||
return data;
|
||||
},
|
||||
initialData: getCachedBranding() ?? undefined,
|
||||
initialDataUpdatedAt: 0,
|
||||
staleTime: 60000,
|
||||
refetchOnWindowFocus: true,
|
||||
retry: 1,
|
||||
|
||||
@@ -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 <AuroraImpl />;
|
||||
}
|
||||
|
||||
function AuroraImpl() {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const animationFrameRef = useRef<number>(0);
|
||||
const rendererRef = useRef<Renderer | null>(null);
|
||||
|
||||
@@ -62,6 +62,7 @@ export function DesktopSidebar({
|
||||
return data;
|
||||
},
|
||||
initialData: getCachedBranding() ?? undefined,
|
||||
initialDataUpdatedAt: 0,
|
||||
staleTime: 60000,
|
||||
refetchOnWindowFocus: true,
|
||||
retry: 1,
|
||||
|
||||
Reference in New Issue
Block a user