Skip to content

feat(#660): Implement offline-first conflict resolution for concurrent edits#723

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
zeemscript:feat/660-offline-conflict-resolution
Jun 28, 2026
Merged

feat(#660): Implement offline-first conflict resolution for concurrent edits#723
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
zeemscript:feat/660-offline-conflict-resolution

Conversation

@zeemscript

Copy link
Copy Markdown
Contributor

Summary

Implements offline-first conflict resolution for concurrent edits, addressing the scenario where users edit notes, quiz drafts,
or profile information while offline and then reconnect to find their mutations conflict with server-side changes.

Changes

  • Request Queue Enhancement: Added lastKnownVersion, clientTimestamp, entityType, and entityId fields to QueuedRequest to track version metadata for conflict detection
  • 409 Conflict Handling: Updated axios interceptor to detect 409 responses, extract conflict data from both request headers and server response, and dispatch to the conflict store
  • Conflict Store: Created Zustand store (conflictStore.ts) to manage conflict queue, active conflict state, resolution history, and modal visibility
  • Conflict Resolution UI: Added ConflictResolutionModal component with:
    • Diff view showing local vs server changes with highlighting
    • Tab navigation between "Differences", "Your Version", and "Server Version" views
    • "Keep Mine" (override server) and "Use Server" (discard local) resolution buttons
    • Accessibility labels and dark mode support
  • App Integration: Integrated ConflictResolutionModal into the root layout for global conflict resolution

Test Plan

  • Run conflict detection tests (npm test -- --testPathPattern="conflict")
  • Test offline mutation that conflicts with server change triggers conflict UI
  • Verify user can choose local or server version
  • Verify conflict UI shows readable diff between versions
  • Verify resolved conflict syncs chosen version back to server

Closes #660


…concurrent edits

- Add lastKnownVersion and clientTimestamp fields to QueuedRequest for conflict detection
- Handle 409 Conflict responses in axios interceptor with conflict data extraction
- Create conflictStore (Zustand) to manage conflict queue and resolution state
- Add ConflictResolutionModal component with diff view (local vs server)
- Integrate modal into app layout for global conflict resolution UI
- Add comprehensive unit tests for conflict handling, store, and modal

Closes rinafcode#660
@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@zeemscript Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit 5b4bef5 into rinafcode:main Jun 28, 2026
1 of 13 checks passed
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.

[Enhancement] Implement offline-first conflict resolution for concurrent edits

2 participants