Fix the issues with the todo items' positions that appear at high latencies#47
Fix the issues with the todo items' positions that appear at high latencies#47fulopkovacs merged 2 commits intomainfrom
Conversation
…tem displacement issues with large network latencies
|
Caution Review failedPull request was closed or merged during review WalkthroughThis pull request introduces a client-side, per-item synchronization engine for todo items with retry logic and status tracking, alongside configuration updates for multiple MCP server definitions. Core functionality shifts from immediate server mutations to a local-first queue-based sync approach with exponential backoff retry handling. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant UI as UI (TodoBoards)
participant Local as Sync Queue<br/>(todoItems)
participant Cache as TanStack<br/>Query Cache
participant Server
participant Retry as Retry Engine
User->>UI: Edit/Drag todo item
UI->>Local: queueLatestSync(item)
Local->>Local: buildPayload, compare signature
alt Signature changed
Local->>Local: Mark as unsynced
end
Local->>Cache: syncTodoItemsQueryCache(item)
Cache-->>UI: Update reflected immediately
Local->>Local: flushItemSync triggered
Local->>Server: updateTodoItem(item, payload)
alt Server success
Server-->>Local: Success response
Local->>Local: Update lastSyncedSignatureById
Local->>Local: Clear retry state
Local->>Cache: Cache stays consistent
else Server failure
Server-->>Local: Error
Local->>Local: Mark as failed/unsynced
Local->>Retry: Schedule retry with backoff
Retry->>Retry: exponential backoff (1s→2s→4s...)
end
User->>UI: Click retry button (optional)
UI->>Local: retryUnsyncedTodoItemsSync()
Local->>Retry: Flush all pending items
Retry->>Server: Attempt failed item syncs
Server-->>Local: Success/continue retry loop
Local->>Cache: Update cache on success
Local->>UI: UI indicators updated
UI-->>User: Sync state reflected
Estimated code review effort🎯 4 (Complex) | ⏱️ ~70 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure the |
🚀 Preview DeploymentStatus: ✅ Ready! Preview URL: Open Preview Commit: Built and deployed successfully |
Added a basic (and very much imperfect) "last-write-wins" mini sync engine that makes sure that the todo items' positions won't unexpectedly change when the network latency is high.
Opencode conversation
Summary by CodeRabbit
New Features
Improvements