Skip to content

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

fix: remove note from topic even if it has no nb

thecodrr97cbbbda0cf4
diff --git a/packages/core/models/topic.js b/packages/core/models/topic.js
index d1991edb3..067f154aa 100644
--- a/packages/core/models/topic.js
+++ b/packages/core/models/topic.js
@@ -53,12 +53,13 @@ export default class Topic {
const topic = qclone(this._topic);
for (let noteId of noteIds) {
let note = this._db.notes.note(noteId);
- if (!this.has(noteId) || !note || note.data.deleted || !note.notebooks)
- return this;
+
+ if (!this.has(noteId) || !note || note.data.deleted) return this;
+
let index = topic.notes.indexOf(noteId);
topic.notes.splice(index, 1);
- let array = note.notebooks;
+ let array = note.notebooks || [];
const notebookIndex = array.findIndex((nb) => nb.id === this._notebookId);
if (notebookIndex === -1) break;