Skip to content

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

fix: no tag with title x found error on sync

thecodrr25ee202d6495
diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.js
index 8d8973066..d2f63b677 100644
--- a/packages/core/collections/notes.js
+++ b/packages/core/collections/notes.js
@@ -25,10 +25,10 @@ export default class Notes extends Collection {
if (noteArg.remote || noteArg.migrated) {
if (oldNote) {
- if (oldNote.color !== noteArg.color) {
+ if (!!oldNote.color && oldNote.color !== noteArg.color) {
await this._db.colors.remove(oldNote.color, id);
}
- if (oldNote.tags) {
+ if (!!oldNote.tags) {
for (let tag of oldNote.tags) {
await this._db.tags.remove(tag, id);
}
diff --git a/packages/core/collections/tags.js b/packages/core/collections/tags.js
index ebaecb22f..5c49c443c 100644
--- a/packages/core/collections/tags.js
+++ b/packages/core/collections/tags.js
@@ -46,7 +46,7 @@ export default class Tags extends Collection {
async remove(tagTitle, noteId) {
if (!tagTitle || !noteId) new Error("tagTitle and noteId cannot be falsy.");
- let tag = this.all.find((t) => t.title === tagTitle);
+ let tag = this.all.find((t) => t.title === tagTitle || t.id === tagTitle);
if (!tag) throw new Error(`No tag with title "${tagTitle}" found.`);
tag = qclone(tag);
const noteIndex = tag.noteIds.indexOf(noteId);