Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

fix: clear stores when user logout

Smaug67397432bc370d9e
diff --git a/frontend/app/stores/nodes.store.ts b/frontend/app/stores/nodes.store.ts
index 603c7a48..a00663c4 100644
--- a/frontend/app/stores/nodes.store.ts
+++ b/frontend/app/stores/nodes.store.ts
@@ -329,6 +329,12 @@ export const useNodesStore = defineStore('nodes', {
allChildrens.forEach(childId => this.nodes.delete(childId));
} else throw request.message;
},
+ clear() {
+ this.nodes.clear();
+ this.public_nodes.clear();
+ this.allTags = [];
+ this.isFetching = false;
+ },
},
});
diff --git a/frontend/app/stores/resources.store.ts b/frontend/app/stores/resources.store.ts
index 7ddd04d5..c36f4470 100644
--- a/frontend/app/stores/resources.store.ts
+++ b/frontend/app/stores/resources.store.ts
@@ -35,5 +35,9 @@ export const useRessourcesStore = defineStore('ressources', {
if (request.status == 'success') return useNodesStore().nodes.delete(id); // Remove the node from the cache
else throw request.message;
},
+ clear() {
+ this.ressources = [];
+ this.isFetching = false;
+ },
},
});
diff --git a/frontend/app/stores/user.store.ts b/frontend/app/stores/user.store.ts
index b7d2d0d8..dfa2eda6 100644
--- a/frontend/app/stores/user.store.ts
+++ b/frontend/app/stores/user.store.ts
@@ -123,7 +123,16 @@ export const useUserStore = defineStore('user', {
},
async post_logout() {
this.user = undefined;
+ useNodesStore().clear();
+ useRessourcesStore().clear();
+ useUserStore().clear();
if (import.meta.client) localStorage.removeItem('isLoggedIn');
},
+ clear() {
+ this.user = undefined;
+ this.users = {};
+ this.last_connection = null;
+ this.current_fetching = [];
+ },
},
});