Skip to content

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

web: fix `cannot read property "type" of undefined` error

Abdullah Atta66203afc9290
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 3175f68e0..094a81e97 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -125,8 +125,6 @@ class EditorStore extends BaseStore {
}
const note = db.notes.note(noteId)?.data || db.notes.trashed(noteId);
- const isDeleted = note.type === "trash";
-
if (!note) return;
noteStore.setSelectedNote(note.id);
@@ -146,6 +144,8 @@ class EditorStore extends BaseStore {
state: SESSION_STATES.new,
attachmentsLength: db.attachments.ofNote(note.id, "all")?.length || 0
};
+
+ const isDeleted = note.type === "trash";
if (isDeleted) {
state.session.isDeleted = true;
state.session.readonly = true;