Reload the page after Reset all finishes

Other pages (Review Queue, Activities) fetch their own data once on mount
and had no way to know activities were deleted elsewhere, so they kept
showing stale rows until a manual reload.
This commit is contained in:
2026-07-19 12:45:03 +02:00
parent 7f7e4b10f0
commit 93746666b5

View File

@@ -89,10 +89,17 @@ export function GarminConnection() {
setError(null);
try {
await api.resetSync();
refreshStatus();
// Reset runs as a background sync job; wait for it to actually finish
// before reloading, otherwise other pages (e.g. Review Queue) would
// still show the just-deleted activities from their own stale state.
let status = await api.syncStatus();
while (status.in_progress) {
await new Promise((resolve) => setTimeout(resolve, 300));
status = await api.syncStatus();
}
window.location.reload();
} catch (e) {
setError(String(e));
} finally {
setBusy(false);
}
}