Skip to content

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

fix: do not cause a rollover sync on remote item write

thecodrr24d7b21a1d1b
diff --git a/packages/core/api/index.js b/packages/core/api/index.js
index 5fad17500..4ad5789be 100644
--- a/packages/core/api/index.js
+++ b/packages/core/api/index.js
@@ -127,7 +127,10 @@ class Database {
};
}
- async _onDBWrite() {
+ _onDBWrite(item) {
+ if (item.remote) {
+ return;
+ }
clearTimeout(this._syncTimeout);
this._syncTimeout = setTimeout(() => {
EV.publish("db:sync");
diff --git a/packages/core/database/cached-collection.js b/packages/core/database/cached-collection.js
index bab88c2d8..02fe4ce40 100644
--- a/packages/core/database/cached-collection.js
+++ b/packages/core/database/cached-collection.js
@@ -21,9 +21,9 @@ export default class CachedCollection extends IndexedCollection {
}
async updateItem(item) {
+ EV.publish("db:write", item);
await super.updateItem(item);
this.map.set(item.id, item);
- EV.publish("db:write", item);
}
exists(id) {