From 571f15b5561002ebe9f081a5cbb981e0ec9296ea Mon Sep 17 00:00:00 2001 From: Muhammad Ali Date: Thu, 25 May 2023 12:14:49 +0500 Subject: [PATCH] web: close deleted note on sync (#2580) Co-authored-by: Abdullah Atta --- apps/web/src/stores/app-store.js | 1 + apps/web/src/stores/editor-store.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/apps/web/src/stores/app-store.js b/apps/web/src/stores/app-store.js index 664babf28..6d10ef863 100644 --- a/apps/web/src/stores/app-store.js +++ b/apps/web/src/stores/app-store.js @@ -151,6 +151,7 @@ class AppStore extends BaseStore { tagStore.refresh(); attachmentStore.refresh(); monographStore.refresh(); + await editorstore.refresh(); this.refreshNavItems(); logger.measure("refreshing app"); diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js index 1c3397015..b9596cb8c 100644 --- a/apps/web/src/stores/editor-store.js +++ b/apps/web/src/stores/editor-store.js @@ -84,6 +84,11 @@ class EditorStore extends BaseStore { }); }; + async refresh() { + const sessionId = this.get().session.id; + if (sessionId && !db.notes.note(sessionId)) await this.clearSession(); + } + updateSession = async (item) => { this.set((state) => { state.session.title = item.title;