diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts index 014c4b237..afdd86700 100644 --- a/apps/web/src/stores/editor-store.ts +++ b/apps/web/src/stores/editor-store.ts @@ -223,11 +223,15 @@ class EditorStore extends BaseStore { // }); }; - async refresh() { - // const sessionId = this.get().session.id; - // if (sessionId && !(await db.notes.exists(sessionId))) - // await this.clearSession(); - } + refresh = async () => { + const { sessions, closeSessions } = this.get(); + const clearIds = []; + for (const session of sessions) { + if ("note" in session && !(await db.notes.exists(session.note.id))) + clearIds.push(session.id); + } + if (clearIds.length > 0) closeSessions(...clearIds); + }; updateSession = ( id: string,