From 9f6a8dc75c18ad079a2a65b16f6a080aace10ad7 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 17 Mar 2024 21:34:50 +0200 Subject: [PATCH] server-ts: Fix undefined in ws --- src/services/ws.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/services/ws.ts b/src/services/ws.ts index 461b0e650..575b6456b 100644 --- a/src/services/ws.ts +++ b/src/services/ws.ts @@ -29,10 +29,10 @@ let lastSyncedPush: number | null = null; interface Message { type: string; data?: { - lastSyncedPush?: number, + lastSyncedPush?: number | null, entityChanges?: any[] }, - lastSyncedPush?: number, + lastSyncedPush?: number | null, progressCount?: number; taskId?: string; @@ -222,7 +222,7 @@ function sendPing(client: WebSocket, entityChangeIds = []) { sendMessage(client, { type: 'frontend-update', data: { - lastSyncedPush: lastSyncedPush || undefined, + lastSyncedPush, entityChanges } }); @@ -237,19 +237,19 @@ function sendTransactionEntityChangesToAllClients() { } function syncPullInProgress() { - sendMessageToAllClients({ type: 'sync-pull-in-progress', lastSyncedPush: lastSyncedPush || undefined }); + sendMessageToAllClients({ type: 'sync-pull-in-progress', lastSyncedPush }); } function syncPushInProgress() { - sendMessageToAllClients({ type: 'sync-push-in-progress', lastSyncedPush: lastSyncedPush || undefined }); + sendMessageToAllClients({ type: 'sync-push-in-progress', lastSyncedPush }); } function syncFinished() { - sendMessageToAllClients({ type: 'sync-finished', lastSyncedPush: lastSyncedPush || undefined }); + sendMessageToAllClients({ type: 'sync-finished', lastSyncedPush }); } function syncFailed() { - sendMessageToAllClients({ type: 'sync-failed', lastSyncedPush: lastSyncedPush || undefined }); + sendMessageToAllClients({ type: 'sync-failed', lastSyncedPush }); } function reloadFrontend(reason: string) {