From 20243b8f648cd71d6f5d665c9a855f385dd09779 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Mon, 11 Dec 2023 10:57:11 +0500 Subject: [PATCH] core: always send realtime sync event --- packages/core/src/api/sync/index.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/core/src/api/sync/index.ts b/packages/core/src/api/sync/index.ts index 608e637cb..81cba6e1f 100644 --- a/packages/core/src/api/sync/index.ts +++ b/packages/core/src/api/sync/index.ts @@ -216,7 +216,7 @@ class Sync { this.connection.off("SendItems"); this.connection.on("SendItems", async (chunk) => { if (this.connection.state !== signalr.HubConnectionState.Connected) - return; + return false; await this.processChunk(chunk, key); @@ -316,11 +316,7 @@ class Sync { this.db.eventManager.publish(EVENTS.databaseSyncRequested, true, false); } - async processChunk( - chunk: SyncTransferItem, - key: SerializedKey, - notify = false - ) { + async processChunk(chunk: SyncTransferItem, key: SerializedKey) { const itemType = chunk.type; if (itemType === "settings") return; @@ -357,11 +353,7 @@ class Sync { ); } - if ( - notify && - (itemType === "note" || itemType === "content") && - items.length > 0 - ) { + if ((itemType === "note" || itemType === "content") && items.length > 0) { items.forEach((item) => this.db.eventManager.publish(EVENTS.syncItemMerged, item) );