fix(system-notices): reset notice store on logout so addon-gated notices show after re-login

This commit is contained in:
jubnl
2026-04-16 14:53:33 +02:00
parent 58a8e97f94
commit 92a1f9c448
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -151,6 +151,7 @@ export const useAuthStore = create<AuthState>()(
logout: () => {
disconnect()
useSystemNoticeStore.getState().reset()
// Tell server to clear the httpOnly cookie
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }).catch(() => {})
// Clear service worker caches containing sensitive data
+5
View File
@@ -31,6 +31,7 @@ interface SystemNoticeState {
fetching: boolean;
fetch: () => Promise<void>;
dismiss: (id: string) => void;
reset: () => void;
}
export const useSystemNoticeStore = create<SystemNoticeState>()((set, get) => ({
@@ -51,6 +52,10 @@ export const useSystemNoticeStore = create<SystemNoticeState>()((set, get) => ({
}
},
reset() {
set({ notices: [], loaded: false, fetching: false });
},
dismiss(id: string) {
// Optimistic: remove immediately
const prev = get().notices;