Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: clear editor if opened note is unlocked

Abdullah Attac6338640738c
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<EditorStore> {
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<NoteStore> {
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;
});