fix: apply wide layout state idempotently
Lint / Lint (push) Successful in 29s
Tests / Go backend (push) Successful in 28s
Tests / Dashboard checks (push) Successful in 36s
Docker / Docker Build & Push (push) Successful in 3m35s

This commit is contained in:
Gabriel20xx committed 2026-10-10 10:42:01 +00:00
1 parent 1fad1cc8d4
commit e475370a20
1 file changed
+10 -2
+10 -2
View File
@@ -11,6 +11,14 @@ function loadInitialWide() {
} }
} }
function applyWide(value) {
if (value) {
document.documentElement.setAttribute('data-wide-layout', 'true');
} else {
document.documentElement.removeAttribute('data-wide-layout');
}
}
let wide = $state(loadInitialWide()); let wide = $state(loadInitialWide());
export const layoutState = { export const layoutState = {
@@ -21,7 +29,7 @@ export const layoutState = {
wide = next; wide = next;
if (!browser) return; if (!browser) return;
document.documentElement.toggleAttribute('data-wide-layout', next); applyWide(next);
try { try {
localStorage.setItem(STORAGE_KEY, String(next)); localStorage.setItem(STORAGE_KEY, String(next));
} catch { } catch {
@@ -33,4 +41,4 @@ export const layoutState = {
}, },
}; };
if (browser) document.documentElement.toggleAttribute('data-wide-layout', wide); if (browser) applyWide(wide);