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: object is not extensible error when add/remove tag
thecodrr5eee1a46bedc
diff --git a/packages/core/models/note.js b/packages/core/models/note.jsindex ac6202969..f7e0c3bb5 100644--- a/packages/core/models/note.js+++ b/packages/core/models/note.js@@ -121,8 +121,8 @@ 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.");- const note = { ...this._note };- note[array].push(tag);+ let arr = [...this._note[array], tag];+ const note = { ...this._note, [array]: arr };await this._notes[collection].add(tag);await this._notes._collection.addItem(note);}@@ -130,8 +130,9 @@ async function addTag(tag, collection, array) {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.");- const note = { ...this._note };- note[array].splice(note[array].indexOf(tag), 1);+ let arr = [...this._note[array]];+ arr.splice(arr.indexOf(tag), 1);+ const note = { ...this._note, [array]: arr };await this._notes[collection].remove(tag);await this._notes._collection.addItem(note);}