Skip to content

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

fix: settings not getting synced after a change

thecodrrbac15941b05b
diff --git a/packages/core/api/settings.js b/packages/core/api/settings.js
index 0cc457a9c..bbe001698 100644
--- a/packages/core/api/settings.js
+++ b/packages/core/api/settings.js
@@ -138,6 +138,7 @@ class Settings {
}
async _saveSettings() {
+ this._settings.dateEdited = Date.now();
await this._db.storage.write("settings", this._settings);
}
}
diff --git a/packages/core/api/sync/collector.js b/packages/core/api/sync/collector.js
index 409f80714..f98e67632 100644
--- a/packages/core/api/sync/collector.js
+++ b/packages/core/api/sync/collector.js
@@ -15,7 +15,6 @@ class Collector {
async collect(lastSyncedTimestamp) {
this._lastSyncedTimestamp = lastSyncedTimestamp;
this.key = await this._db.user.getEncryptionKey();
-
return {
notes: await this._encrypt(this._collect(this._db.notes.raw)),
notebooks: await this._encrypt(this._collect(this._db.notebooks.raw)),
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.js
index 9db2c6d16..560547896 100644
--- a/packages/core/api/sync/index.js
+++ b/packages/core/api/sync/index.js
@@ -157,7 +157,7 @@ export default class Sync {
this.stopAutoSync();
this._autoSyncTimeout = setTimeout(() => {
EV.publish(EVENTS.databaseSyncRequested);
- }, this._autoSyncTimeout);
+ }, this._autoSyncInterval);
}
async _send(data) {
diff --git a/packages/core/api/sync/utils.js b/packages/core/api/sync/utils.js
index 36b231612..6a7351c0b 100644
--- a/packages/core/api/sync/utils.js
+++ b/packages/core/api/sync/utils.js
@@ -1,6 +1,9 @@
function areAllEmpty(obj) {
- const arrays = Object.values(obj).filter((v) => v && v.length !== undefined);
- return arrays.every((array) => array.length === 0);
+ for (let key in obj) {
+ const value = obj[key];
+ if (Array.isArray(value) && value.length > 0) return false;
+ }
+ return true;
}
export { areAllEmpty };