fix(mothership): stabilize task sidebar ordering on selection#4309
fix(mothership): stabilize task sidebar ordering on selection#4309waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit f15f34b. Configure here. |
Greptile SummaryFour targeted fixes that eliminate sidebar task-ordering jitter: drop Confidence Score: 5/5Safe to merge — all changes are narrow, well-justified, and covered by existing tests. No P0 or P1 findings. All four changes address a clear root cause with no observed regressions. The only remark is a P2 test-description nit. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Sidebar
participant FolderStore
participant SSE as SSE (task_status)
participant TQ as TanStack Query
participant Server
User->>Sidebar: click task (no shift/meta)
Sidebar->>FolderStore: selectTaskOnly(taskId)
FolderStore-->>FolderStore: selectedTasks={taskId}, clear workflows/folders
User->>Sidebar: mark task read
Sidebar->>TQ: cancelQueries(taskList)
TQ-->>TQ: optimistic update isUnread=false
Sidebar->>Server: PATCH lastSeenAt
Server-->>Sidebar: 200 OK
Note over TQ: no invalidation — optimistic update is equivalent to server state
SSE-->>Sidebar: task_status event
Sidebar->>Sidebar: parseTaskStatusEventPayload(data)
alt valid payload
Sidebar->>TQ: invalidateQueries(taskList)
TQ->>Server: refetch task list
else invalid payload
Sidebar->>Sidebar: log warn, return early
end
Reviews (2): Last reviewed commit: "fix(mothership): stabilize task sidebar ..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f15f34b. Configure here.
Summary
keepPreviousDatafromuseTasks— was on a static key, caused stale-then-snap reorders on invalidationuseMarkTaskRead/useMarkTaskUnread— server only flipslastSeenAt, optimistic update is sufficienttask_statuspayload before invalidating the task list — drop bogus events instead of triggering a refetchselectTaskOnlyin sidebar click handler so non-shift clicks match the rest of the selection model (clears workflow/folder selections, populatesselectedTasks)Type of Change
Testing
Tested manually. 8/8 unit tests pass (
hooks/queries/tasks.test.ts,hooks/use-task-events.test.ts).Checklist