Skip to content

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

fix: request sync before sse connects (fixes streetwriters/notesnook#465)

thecodrr8c65fbb996ea
diff --git a/packages/core/api/index.js b/packages/core/api/index.js
index b4a81e7cf..8d4066d86 100644
--- a/packages/core/api/index.js
+++ b/packages/core/api/index.js
@@ -146,6 +146,7 @@ class Database {
async connectSSE(args) {
await this.sseMutex.runExclusive(async () => {
if (args && !!args.error) return;
+ this.eventManager.publish(EVENTS.databaseSyncRequested, true, false);
const forceReconnect = args && args.force;
if (
@@ -164,7 +165,6 @@ class Database {
this.evtSource.onopen = async () => {
console.log("SSE: opened channel successfully!");
- this.eventManager.publish(EVENTS.databaseSyncRequested, true, false);
};
this.evtSource.onerror = function (error) {