fix(launch_bar): sync status not correctly rendered

This commit is contained in:
Elian Doran 2025-12-08 11:30:33 +02:00
parent f98c77bd16
commit a201b43cde
No known key found for this signature in database

View File

@ -95,19 +95,21 @@ function useSyncStatus() {
// Determine if all changes were pushed. // Determine if all changes were pushed.
const allChangesPushed = lastSyncedPush === ws.getMaxKnownEntityChangeSyncId(); const allChangesPushed = lastSyncedPush === ws.getMaxKnownEntityChangeSyncId();
let syncState: SyncState = "unknown"; switch (message.type) {
if (message.type === "sync-pull-in-progress") { case "sync-pull-in-progress":
syncState = "in-progress"; case "sync-push-in-progress":
} else if (message.type === "sync-push-in-progress") { setSyncState("in-progress");
syncState = "in-progress"; break;
} else if (message.type === "sync-finished") { case "sync-finished":
syncState = allChangesPushed ? "connected-no-changes" : "connected-with-changes"; setSyncState(allChangesPushed ? "connected-no-changes" : "connected-with-changes");
} else if (message.type === "sync-failed") { break;
syncState = allChangesPushed ? "disconnected-no-changes" : "disconnected-with-changes"; case "sync-failed":
} else if (message.type === "frontend-update") { setSyncState(allChangesPushed ? "disconnected-no-changes" : "disconnected-with-changes");
break;
case "frontend-update":
lastSyncedPush = message.data.lastSyncedPush; lastSyncedPush = message.data.lastSyncedPush;
break;
} }
setSyncState(syncState);
} }
subscribeToMessages(onMessage); subscribeToMessages(onMessage);