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
fix: make copy of note before add/remove tag
thecodrr231b028c8aae
diff --git a/packages/core/models/note.js b/packages/core/models/note.jsindex 89df66448..ac6202969 100644--- a/packages/core/models/note.js+++ b/packages/core/models/note.js@@ -121,15 +121,17 @@ export default class Note {async function addTag(tag, collection, array) {if (this._note[array].indexOf(tag) > -1)throw new Error("Cannot add a duplicate tag.");- this._note[array].push(tag);+ const note = { ...this._note };+ note[array].push(tag);await this._notes[collection].add(tag);- await this._notes._collection.addItem(this._note);+ await this._notes._collection.addItem(note);}async function removeTag(tag, collection, array) {if (this._note[array].indexOf(tag) <= -1)throw new Error("This note is not tagged by the specified tag.");- this._note[array].splice(this._note[array].indexOf(tag), 1);+ const note = { ...this._note };+ note[array].splice(note[array].indexOf(tag), 1);await this._notes[collection].remove(tag);- await this._notes._collection.addItem(this._note);+ await this._notes._collection.addItem(note);}