Add application state reset on login page mount
- Reset all application state on login page - Clear authentication and session storage - Reset graph, backend, and settings state - Ensure clean environment for new session - Centralized state reset in navigation service
This commit is contained in:
@@ -4,6 +4,7 @@ import { useAuthStore } from '@/stores/state'
|
||||
import { loginToServer, getAuthStatus } from '@/api/lightrag'
|
||||
import { toast } from 'sonner'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { navigationService } from '@/services/navigation'
|
||||
|
||||
import { Card, CardContent, CardHeader } from '@/components/ui/Card'
|
||||
import Input from '@/components/ui/Input'
|
||||
@@ -20,6 +21,11 @@ const LoginPage = () => {
|
||||
const [password, setPassword] = useState('')
|
||||
const [checkingAuth, setCheckingAuth] = useState(true)
|
||||
|
||||
// Reset application state on first mount
|
||||
useEffect(() => {
|
||||
navigationService.resetAllApplicationState();
|
||||
}, []); // Empty dependency array means this runs only once on mount
|
||||
|
||||
// Check if authentication is configured
|
||||
useEffect(() => {
|
||||
let isMounted = true; // Flag to prevent state updates after unmount
|
||||
|
Reference in New Issue
Block a user