From f35a3d8fa3abc4729eb0b697c753fb1c8df07025 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 5 Mar 2024 15:37:45 +0500 Subject: [PATCH] web: clear editor on unlocking the note --- apps/web/src/stores/editor-store.js | 14 ++++++++------ apps/web/src/stores/note-store.js | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js index 6fdbe1d83..d8485cb97 100644 --- a/apps/web/src/stores/editor-store.js +++ b/apps/web/src/stores/editor-store.js @@ -290,12 +290,14 @@ class EditorStore extends BaseStore { state: SESSION_STATES.new }; }); - noteStore.setSelectedNote(0); - this.toggleProperties(false); - if (shouldNavigate) - hashNavigate(`/notes/create`, { replace: true, addNonce: true }); - setTimeout(() => appStore.setIsEditorOpen(false), 100); - setDocumentTitle(); + setTimeout(() => { + noteStore.setSelectedNote(0); + this.toggleProperties(false); + if (shouldNavigate) + hashNavigate(`/notes/create`, { replace: true, addNonce: true }); + appStore.setIsEditorOpen(false); + setDocumentTitle(); + }, 100); }; setTitle = (noteId, title) => { diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js index 78fcb6e20..5ea0a3a83 100644 --- a/apps/web/src/stores/note-store.js +++ b/apps/web/src/stores/note-store.js @@ -116,7 +116,7 @@ class NoteStore extends BaseStore { unlock = async (id) => { return await Vault.unlockNote(id).then(async (res) => { if (editorStore.get().session.id === id) - await editorStore.openSession(id); + await editorStore.clearSession(true); this.refreshItem(id); return res; });