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: send databaseUpdated event on all writes
thecodrree30d3050612
diff --git a/packages/core/collections/trash.js b/packages/core/collections/trash.jsindex 0f33acbb7..89d136794 100644--- a/packages/core/collections/trash.js+++ b/packages/core/collections/trash.js@@ -47,7 +47,6 @@ export default class Trash {async add(item) {const collection = collectionNameFromItem(item);- console.log("Adding to trash.", item, collection);if (!item || !item.type || !collection) return;// if (item.dateDeleted || item.deleted || item.migrated) {// return await this._collection.addItem(item);diff --git a/packages/core/database/cached-collection.js b/packages/core/database/cached-collection.jsindex 683052d27..0c3ecbc08 100644--- a/packages/core/database/cached-collection.js+++ b/packages/core/database/cached-collection.js@@ -21,7 +21,6 @@ export default class CachedCollection extends IndexedCollection {}async updateItem(item) {- EV.publish(EVENTS.databaseUpdated, item);await super.updateItem(item);this.map.set(item.id, item);}diff --git a/packages/core/database/indexed-collection.js b/packages/core/database/indexed-collection.jsindex 9536ddbca..c8af11486 100644--- a/packages/core/database/indexed-collection.js+++ b/packages/core/database/indexed-collection.js@@ -1,3 +1,4 @@+import { EV, EVENTS } from "../common";import Indexer from "./indexer";export default class IndexedCollection {@@ -32,9 +33,11 @@ export default class IndexedCollection {delete item.remote;delete item.migrated;await this.indexer.write(item.id, item);+ EV.publish(EVENTS.databaseUpdated, item);}removeItem(id) {+ EV.publish(EVENTS.databaseUpdated, id);return this.updateItem({id,deleted: true,@@ -43,6 +46,7 @@ export default class IndexedCollection {}async deleteItem(id) {+ EV.publish(EVENTS.databaseUpdated, id);await this.indexer.deindex(id);return await this.indexer.remove(id);}