feat: local vs server sync (M2-10227)#1062
Open
sricharan-varanasi wants to merge 37 commits intodevfrom
Open
Conversation
This reverts commit 6aef043.
- Update CompletedEntityDto to make localEndDate and localEndTime nullable to match DB schema
When syncing in-progress flows from the server, reconstruct the FlowState with the correct pipeline and step, then save it to local storage. This ensures that when the user clicks Resume, the flow continues from the correct activity instead of starting from the beginning.
d830445 to
aa19cff
Compare
divbzero
approved these changes
Jan 28, 2026
Contributor
divbzero
left a comment
There was a problem hiding this comment.
Just a few minor questions. Otherwise looks good!
54d648e to
c2e03aa
Compare
- Add getAppletCompletedEntities API method to IEventsService - Implement single-applet completions endpoint in eventsService - Create TargetedProgressSyncService for targeted sync without full refresh - Fetches only one applet's completions instead of all applets
- Use useTargetedSync hook instead of useRefreshMutation - Remove loading spinner (sync is fast and non-blocking) - Keep AppletsRefresh for manual pull-to-refresh
…reen - Use useTargetedSync hook instead of useRefreshMutation - Add isRefreshing state to useTargetedSync for loading feedback - Keep loading spinner for safety during sync
maxto024
suggested changes
Feb 4, 2026
- Enhanced AppletsRefresh to sync applet data before rescheduling notifications when appletId is provided - Modified ActivityListScreen to pass appletId to AppletsRefresh for targeted data sync on pull-to-refresh - Added query invalidation in Intermediate.tsx and Finish.tsx to automatically update activity list after completing activities
- Add subjectId to AppletRespondentMetaDto to access logged-in user's ID - Make CompletedEntityDto.targetSubjectId nullable to match web's type definition - Add QueryDataUtils.getRespondentMeta() to access cached respondent data - Normalize targetSubjectId in ProgressSyncService: if it equals the logged-in user's subjectId, convert it to null before creating storage keys
e0f600a to
bf45880
Compare
6009c8c to
538640f
Compare
divbzero
reviewed
Feb 10, 2026
divbzero
reviewed
Feb 13, 2026
- Revert slice.ts to pre-removal version (already has web-matching submitId logic) - Add matching submitId comparison logic to ProgressSyncService.reconstructFlowState - Both layers now use same skip logic to stay in sync: - Same submitId: keep furthest progress in this submission - Different submitId: keep furthest in-progress OR most recent completed
divbzero
approved these changes
Feb 13, 2026
Contributor
divbzero
left a comment
There was a problem hiding this comment.
The updated logic in src/entities/applet/model/services/ProgressSyncService.ts and src/entities/applet/model/slice.ts looks good. Thank you @sricharan-varanasi!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
🔗 Jira Ticket M2-10227
🔗 Jira Ticket M2-10405
Implements cross-device flow completion detection and sync improvements to handle users resuming flows across multiple devices.
Changes include:
Backend Enhancement:
getAppletCompletedEntitiesAPI endpoint to fetch completion data for a single applet (instead of all applets)New Services & Hooks:
TargetedProgressSyncService- syncs completion data for one specific applet without triggering full applet refreshuseTargetedSyncReact hook - provides easy integration withsyncApplet(appletId)function andisRefreshingstateScreen Updates:
InProgressActivityScreen - replaced full refresh with targeted sync when resuming activities
ActivityListScreen - replaced full refresh with targeted sync after completing activities
Added cross-device completion check when resuming flows - detects if a flow was completed on another device and blocks resumption with user notification
Enhanced flow state reconstruction from server data with proper activity order tracking
Improved sync logic for in-progress flows to maintain correct flow state across devices
Added conflict resolution for completed vs in-progress flow states
Extended flow state tracking to include
remainingActivityOrdersfor accurate flow position reconstruction🪤 Peer Testing
Test cross-device flow completion:
Start a flow on Device A and complete the first activity
On Device B, pull to refresh the applet list
Tap Resume on the same flow
On Device A, complete the entire flow
On Device B, tap Next to proceed in the flow
Expected outcome: Alert appears stating "This flow was completed on another device" and the view refreshes to show the completed state
Test flow reconstruction after sync:
Start a multi-activity flow on Device A and complete 2 activities
Force close the app on Device A
On Device B, resume the flow from the beginning
Expected outcome: Flow resumes from activity 3 (where Device A left off), not from the beginning
✏️ Notes