From eedfe38b26a84a7e007b863f4a253cba018add3f Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 22 Feb 2024 23:26:46 +0500 Subject: [PATCH] web: clear editor if opened note is unlocked --- apps/web/src/stores/editor-store.ts | 4 ++-- apps/web/src/stores/note-store.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts index bacec102b..8a83ceb5b 100644 --- a/apps/web/src/stores/editor-store.ts +++ b/apps/web/src/stores/editor-store.ts @@ -320,9 +320,9 @@ class EditorStore extends BaseStore { state: SESSION_STATES.new }; }); + noteStore.setSelectedNote(); + this.toggleProperties(false); setTimeout(() => { - noteStore.setSelectedNote(); - this.toggleProperties(false); if (shouldNavigate) hashNavigate(`/notes/create`, { replace: true, addNonce: true }); appStore.setIsEditorOpen(false); diff --git a/apps/web/src/stores/note-store.ts b/apps/web/src/stores/note-store.ts index 68ff4570f..97065ff08 100644 --- a/apps/web/src/stores/note-store.ts +++ b/apps/web/src/stores/note-store.ts @@ -98,7 +98,7 @@ class NoteStore extends BaseStore { unlock = async (id: string) => { return await Vault.unlockNote(id).then(async (res) => { if (editorStore.get().session.id === id) - await editorStore.openSession(id); + await editorStore.clearSession(true); await this.refresh(); return res; });