Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: clear cache after logout (#13372)

ecmadaoe352c23a37b6
diff --git a/frontend/src/AppRootContext.ts b/frontend/src/AppRootContext.ts
index 9a4b65a825..e1619c42c1 100644
--- a/frontend/src/AppRootContext.ts
+++ b/frontend/src/AppRootContext.ts
@@ -5,6 +5,7 @@ import {
useInstanceV1Store,
useProjectV1Store,
} from "./store";
+import { clearListCache } from "./store/modules/v1/cache";
export type AppRootContext = {
key: Ref<number>;
@@ -33,4 +34,6 @@ export const restartAppRoot = () => {
useDatabaseV1Store().reset();
useProjectV1Store().reset();
useInstanceV1Store().reset();
+
+ clearListCache();
};
diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.ts
index 1ea929971d..3a1ca62f23 100644
--- a/frontend/src/store/modules/auth.ts
+++ b/frontend/src/store/modules/auth.ts
@@ -1,6 +1,7 @@
import axios from "axios";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
+import { restartAppRoot } from "@/AppRootContext";
import { authServiceClient } from "@/grpcweb";
import { unknownUser } from "@/types";
import { userBindingPrefix } from "@/types";
@@ -72,6 +73,7 @@ export const useAuthStore = defineStore("auth_v1", () => {
try {
await axios.post("/v1/auth/logout");
currentUserId.value = undefined;
+ restartAppRoot();
} catch {
// nothing
}
diff --git a/frontend/src/store/modules/v1/cache.ts b/frontend/src/store/modules/v1/cache.ts
index 72cd41eeaf..634774593a 100644
--- a/frontend/src/store/modules/v1/cache.ts
+++ b/frontend/src/store/modules/v1/cache.ts
@@ -50,9 +50,18 @@ export const useListCache = (namespace: string) => {
return undefined;
};
+ const clearCache = () => {
+ LIST_CACHE.delete(namespace);
+ };
+
return {
cacheMap: listCache,
getCacheKey,
getCache,
+ clearCache,
};
};
+
+export const clearListCache = () => {
+ LIST_CACHE.clear();
+};