Skip to content

fix(sync): sum remaining blocks across devices in data sync progress - #212

Draft
gmaclennan wants to merge 2 commits into
mainfrom
fix/sync-progress-count
Draft

gmaclennan wants to merge 2 commits into
mainfrom
fix/sync-progress-count

Conversation

@gmaclennan

@gmaclennan gmaclennan commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

When syncing with more than one device at once, the data sync progress reported by useDataSyncProgress can jump to 1 (complete) while another peer, typically the cloud archive, still has blocks to exchange. It looks intermittent because it only shows when the device that finished first happens to be the last one enumerated.

The cause is in src/lib/sync.ts: inside the loop over enabled devices, totalMaxSyncCount is accumulated with += but currentSyncCount is assigned with =, so only the last device's remaining count survives. The change makes it += so progress reflects the remaining blocks across all devices.

The new test in test/lib/sync.test.ts drives SyncStore directly with a fake $sync rather than real IPC peers, since the existing progress test in projects.test.tsx has no multi-peer setup. It can move there if the hook-level route is preferred.

Related changes. A premature "complete" is one of the reasons people leave the Exchange screen or press Stop while the cloud still wants blocks. digidem/comapeo-mobile#2213 keeps the server connection when the user leaves anyway, and digidem/comapeo-core#1353 keeps serving after Stop. This fix is independent of both and the cheapest of the three.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant