-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce improved sync screen experience #619
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't review the UI code too heavily but this LGTM!
src/frontend/hooks/useSyncState.ts
Outdated
|
||
// Remove devices from #perDeviceMaxSyncCount that are no longer found in the new sync state | ||
for (const deviceId of this.#perDeviceMaxSyncCount.keys()) { | ||
if (!connectedDevices.includes(deviceId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this is O(N) but could be O(1).
if (!connectedDevices.includes(deviceId)) { | |
if (!Object.hasOwn(state.remoteDeviceSyncState, deviceId)) { |
(Is this the first time Big O notation has ever been relevant in my career? For this tiny nitpick?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed via 235dd9b
WifiIcon, | ||
} from '../../sharedComponents/icons'; | ||
|
||
type SyncStage = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this.
// @ts-expect-error | ||
throw new Error(`Invalid status: ${syncStage.status}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: consider ExhaustivenessError
. Same comment applies to the switch
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed via b11818b
</Text> | ||
)} | ||
</View> | ||
); | ||
} | ||
|
||
function deriveSyncStage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this could be useful to test? Wrote tests in this gist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed via cccd6df
Closes #550
Closes #602
Closes #603
Closes #604
Towards #605
Closes #610
Important notes:
There is a bug where sync can occur without opt-in by connected peers. This is backend-related (see Sync can unexpectedly occur with devices that have not enabled it comapeo-core#762).
Upgrades core to latest alpha version, which introduces a new sync state api and also the ability to set/configure sync autostopping
This PR does not change the behavior related to sync being turned off when leaving the screen. I think that can/should be a follow-up PR that also introduces auto-stopping sync when leaving the screen after being fully synced.
Not an exhaustive showcase of all of the states (hard to do with just 2 devices)
01-sync-alone.mov
02-sync-no-data.mov
03-sync-with-data.mp4