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:
@@ -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
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user