From 6c837d21fa35053f441edffa1464b2e125bf0485 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Sun, 17 Aug 2025 07:00:15 +0000 Subject: [PATCH] fix: apply theme preference on login page - Login component now applies saved theme preference on mount - Theme preference correctly persists across logout/login in all modes - Fixes issue where login page would revert to default theme after logout --- frontend-modern/src/components/Login.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend-modern/src/components/Login.tsx b/frontend-modern/src/components/Login.tsx index 9224047b3..4a5def36b 100644 --- a/frontend-modern/src/components/Login.tsx +++ b/frontend-modern/src/components/Login.tsx @@ -1,5 +1,6 @@ import { Component, createSignal, Show, onMount, lazy, Suspense } from 'solid-js'; import { setBasicAuth } from '@/utils/apiClient'; +import { STORAGE_KEYS } from '@/constants'; // Force include FirstRunSetup with lazy loading const FirstRunSetup = lazy(() => import('./FirstRunSetup').then(m => ({ default: m.FirstRunSetup }))); @@ -17,6 +18,14 @@ export const Login: Component = (props) => { const [loadingAuth, setLoadingAuth] = createSignal(true); onMount(async () => { + // Apply saved theme preference + const savedTheme = localStorage.getItem(STORAGE_KEYS.DARK_MODE); + if (savedTheme === 'true') { + document.documentElement.classList.add('dark'); + } else { + document.documentElement.classList.remove('dark'); + } + console.log('[Login] Starting auth check...'); try { const response = await fetch('/api/security/status');