fix: request sync before sse connects

(fixes streetwriters/notesnook#465)
This commit is contained in:
thecodrr
2022-04-14 01:10:25 +05:00
parent 94f27f85a9
commit 8c65fbb996

View File

@@ -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) {