web: clear editor if opened note is unlocked

This commit is contained in:
Abdullah Atta
2024-02-22 23:26:46 +05:00
parent 77ee56dd14
commit c633864073
2 changed files with 3 additions and 3 deletions

View File

@@ -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);

View File

@@ -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;
});