-
Notifications
You must be signed in to change notification settings - Fork 0
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: sync push #2413
feat: sync push #2413
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.
ok, did a first pass. i would say the only comment that feels kinda blocking-ish is the ask for tests on the PushDispatcher
separately, i feel like it would be really nice to have some good documentation of how the sync system works, i spent a while staring blankly at sync.ts
which i think is partly because i just have a hard time keeping the high-level view of the system straight in my head while going through the weeds of the code, which would be alleviated by a proper write-up
dev-client/src/model/soilId/actions/remoteSoilDataActions.test.ts
Outdated
Show resolved
Hide resolved
fd9cd87
to
b3f6569
Compare
b3f6569
to
99542bd
Compare
Description Enhance the basic soilDataDiff system introduced in #2279 to support tracking changes to all fields. The new methods plug into the remoteSoilDataActions methods for generating push input and populate the push input with the diff of the last-synced data from the server. Note: this PR must be reviewed after #2413, as it builds on that changeset.
Description
Integrate change-tracking, local soil data logic, and soil data push endpoint into full push system. This is comprised of the following notable pieces:
PushDispatcher
component listens for unsynced soil data and, when the app is online, dispatches a push to the server. It will also initialize a retry cycle on failure, which will end the next time the soil sync state changes (i.e., if a push succeed, the user makes new changes, or offline status changes.)soilIdSlice
has been updated to ingest push results using theapplySyncActionResults
method, which handles updating internal recordkeeping based on push operation results. In particular, it only ingests results that are "up-to-date" (the result is for the same revision ID as the record's current revision ID).sync
model has been updated to include support for sync errors. Records which had an error on the last sync are still considered 'synced' until their next change and retain the last-known 'successful' data.remoteSoilDataActions
contains logic for turning theChangeRecords
representing a user's un-synced changes into input for thePush
mutation.soilDataDiff
contains the bare-minimum logic needed to compare soil data versions, so that we can indicate to the server when a depth interval has been removed. (To be expanded upon in [Offline] Field-level change tracking for mobile client push #2283)sync
file has been split intorevisions
,records
, andresults
for better separation of concerns and readability.Checklist
Related Issues
#2279
Verification steps