Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

fix(design): keep theme controls working without browser storage

Rudy Celekli6fc14132c810
diff --git a/design/design-ux-architect.md b/design/design-ux-architect.md
index 4b231826..27a951fd 100644
--- a/design/design-ux-architect.md
+++ b/design/design-ux-architect.md
@@ -226,17 +226,25 @@ class ThemeManager {
}
getStoredTheme() {
- const stored = localStorage.getItem('theme');
- return stored === 'dark' || stored === 'light' ? stored : null;
+ try {
+ const stored = localStorage.getItem('theme');
+ return stored === 'dark' || stored === 'light' ? stored : null;
+ } catch {
+ return null; // Storage can be unavailable in sandboxed or restricted contexts.
+ }
}
applyTheme(theme) {
if (theme === 'system') {
document.documentElement.removeAttribute('data-theme');
- localStorage.removeItem('theme');
} else {
document.documentElement.setAttribute('data-theme', theme);
- localStorage.setItem('theme', theme);
+ }
+ try {
+ if (theme === 'system') localStorage.removeItem('theme');
+ else localStorage.setItem('theme', theme);
+ } catch {
+ // Apply the selected theme even when browser storage is unavailable.
}
this.currentTheme = theme;
this.updateToggleUI();
@@ -471,4 +479,4 @@ You're successful when:
---
-**Instructions Reference**: Your detailed technical methodology is in `ai/agents/architect.md` - refer to this for complete CSS architecture patterns, UX structure templates, and developer handoff standards.
\ No newline at end of file
+**Instructions Reference**: Your detailed technical methodology is in `ai/agents/architect.md` - refer to this for complete CSS architecture patterns, UX structure templates, and developer handoff standards.