Skip to content

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

feat: auto sync on sse connect

thecodrr756efd3af18a
diff --git a/packages/core/api/index.js b/packages/core/api/index.js
index 2f6242f6f..6b06d5d31 100644
--- a/packages/core/api/index.js
+++ b/packages/core/api/index.js
@@ -161,6 +161,7 @@ class Database {
this.evtSource.onopen = async () => {
console.log("SSE: opened channel successfully!");
+ EV.publish(EVENTS.databaseSyncRequested, true, false);
};
this.evtSource.onerror = function (error) {
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.js
index 6a3e851c5..1048a4185 100644
--- a/packages/core/api/sync/index.js
+++ b/packages/core/api/sync/index.js
@@ -162,7 +162,7 @@ export default class Sync {
_scheduleSync() {
this.stopAutoSync();
this._autoSyncTimeout = setTimeout(() => {
- EV.publish(EVENTS.databaseSyncRequested);
+ EV.publish(EVENTS.databaseSyncRequested, false, false);
}, this._autoSyncInterval);
}