Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

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

jubnl92a1f9c448e2
diff --git a/client/src/store/authStore.ts b/client/src/store/authStore.ts
index 4a3f8a84b..74fe01e10 100644
--- a/client/src/store/authStore.ts
+++ b/client/src/store/authStore.ts
@@ -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
diff --git a/client/src/store/systemNoticeStore.ts b/client/src/store/systemNoticeStore.ts
index 249b0b6bb..e3a979ef0 100644
--- a/client/src/store/systemNoticeStore.ts
+++ b/client/src/store/systemNoticeStore.ts
@@ -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;