From 234bd13453042b924efb3673c1e3921f12754e0b Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Mon, 18 May 2026 01:59:43 +0100 Subject: [PATCH] fix(auth): clear page indexeddb databases on logout --- apps/client/src/features/auth/hooks/use-auth.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/client/src/features/auth/hooks/use-auth.ts b/apps/client/src/features/auth/hooks/use-auth.ts index 970a85897..509dee931 100644 --- a/apps/client/src/features/auth/hooks/use-auth.ts +++ b/apps/client/src/features/auth/hooks/use-auth.ts @@ -166,6 +166,18 @@ export default function useAuth() { const handleLogout = async () => { setCurrentUser(RESET); await logout(); + + try { + if (typeof indexedDB?.databases === "function") { + const dbs = await indexedDB.databases(); + dbs + .filter((db) => db.name?.startsWith("page.")) + .forEach((db) => indexedDB.deleteDatabase(db.name!)); + } + } catch { + // + } + window.location.replace(`${APP_ROUTE.AUTH.LOGIN}?logout=1`); };