A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
core: fix "Cannot read property type of undefined"
Abdullah Attaa24658ac0eea
diff --git a/packages/core/src/collections/notebooks.js b/packages/core/src/collections/notebooks.jsindex b64ed3146..18a61fe9b 100644--- a/packages/core/src/collections/notebooks.js+++ b/packages/core/src/collections/notebooks.js@@ -143,7 +143,11 @@ export default class Notebooks extends Collection {* @returns {Notebook} The notebook of the given id*/notebook(id) {- let notebook = id.type ? id : this._collection.getItem(id);+ if (!id) return;+ let notebook =+ typeof id === "object" && "type" in id+ ? id+ : this._collection.getItem(id);if (!notebook || notebook.deleted) return;return new Notebook(notebook, this._db);}diff --git a/packages/core/src/collections/notes.js b/packages/core/src/collections/notes.jsindex 06569b775..be132a76f 100644--- a/packages/core/src/collections/notes.js+++ b/packages/core/src/collections/notes.js@@ -146,7 +146,10 @@ export default class Notes extends Collection {*/note(id) {if (!id) return;- let note = id.type ? id : this._collection.getItem(id);+ let note =+ typeof id === "object" && "type" in id+ ? id+ : this._collection.getItem(id);if (!note || note.deleted) return;return new Note(note, this._db);}