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: reduce cloning
thecodrra087d68dad0a
diff --git a/packages/core/collections/notebooks.js b/packages/core/collections/notebooks.jsindex f684ce266..3de365cda 100644--- a/packages/core/collections/notebooks.js+++ b/packages/core/collections/notebooks.js@@ -4,6 +4,7 @@ import Notebook from "../models/notebook";import sort from "fast-sort";import getId from "../utils/id";import { CHECK_IDS, sendCheckUserStatusEvent } from "../common";+import { qclone } from "qclone";var tfun = require("transfun/transfun.js").tfun;if (!tfun) {tfun = global.tfun;@@ -85,10 +86,11 @@ export default class Notebooks extends Collection {for (let id of ids) {let notebook = this.notebook(id);if (!notebook) continue;+ const notebookData = qclone(notebook.data);await notebook.topics.delete(...notebook.data.topics);await this._collection.removeItem(id);await this._db.settings.unpin(id);- await this._db.trash.add(notebook.data);+ await this._db.trash.add(notebookData);}}diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.jsindex 4bc9c1f52..994ddf2d4 100644--- a/packages/core/collections/notes.js+++ b/packages/core/collections/notes.js@@ -159,7 +159,7 @@ export default class Notes extends Collection {* @param {"asc"|"desc"} sort*/group(by, sort = "desc") {- let notes = qclone(this.all);+ let notes = this.all;switch (by) {case "abc":diff --git a/packages/core/collections/trash.js b/packages/core/collections/trash.jsindex 5848deb00..666e72fb2 100644--- a/packages/core/collections/trash.js+++ b/packages/core/collections/trash.js@@ -26,6 +26,7 @@ export default class Trash extends Collection {}async add(item) {+ if (!item && !item.type) return;if (item.dateDeleted || item.deleted || item.migrated) {return await this._collection.addItem(item);}