Merge pull request #138 from router-for-me/codex/fix-usage-stats-cache-leak-on-logout

fix(auth): clear usage stats store on logout
This commit is contained in:
Supra4E8C
2026-03-10 12:24:15 +08:00
committed by GitHub
Unverified
+2
View File
@@ -10,6 +10,7 @@ import { STORAGE_KEY_AUTH } from '@/utils/constants';
import { secureStorage } from '@/services/storage/secureStorage';
import { apiClient } from '@/services/api/client';
import { useConfigStore } from './useConfigStore';
import { useUsageStatsStore } from './useUsageStatsStore';
import { detectApiBaseFromLocation, normalizeApiBase } from '@/utils/connection';
interface AuthStoreState extends AuthState {
@@ -136,6 +137,7 @@ export const useAuthStore = create<AuthStoreState>()(
logout: () => {
restoreSessionPromise = null;
useConfigStore.getState().clearCache();
useUsageStatsStore.getState().clearUsageStats();
set({
isAuthenticated: false,
apiBase: '',