Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec3b24945b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| queryClient.isMutating({ mutationKey: chatReadStateMutationKey }) <= 1 | ||
| ) { | ||
| await invalidateChatListQueries(queryClient); |
There was a problem hiding this comment.
Invalidate after concurrently settling read mutations
When two read-state requests finish concurrently, both onSettled callbacks can observe an active count of 2 and skip invalidation, so no callback performs the promised final refetch. TanStack Query keeps each mutation pending until its onSettled promise returns, dispatching success only afterward (v5.82.0 source), which makes this race possible. In a paginated read/unread filter, the retained optimistic rows then leave server offsets shifted and later fetchNextPage calls can permanently skip chats until another external refetch occurs.
Useful? React with 👍 / 👎.
Depends on #30300. Part 3 of 3 in the per-surface chat mutation stack: #30276 → #30299 → #30300 → this PR.
Move manual mark-as-read/unread mutations into sidebar rows and remove their layout-owned callbacks. Keep automatic active-chat read synchronization in the layout. Pending state follows each chat across row remounts, disables only that chat’s read toggle, and leaves other chats actionable.
Read-filter projection now retains cached roots for optimistic rollback. A failed mutation restores only the target’s read flag on still-existing cache entries, preserving other pending chats and newer responses; list refetch waits for the last pending read mutation.
Reviewer context
Coverage exercises read-filter unmount/remount, same-chat blocking, concurrent different-chat mutations, rollback without resurrecting removed rows, and hiding the active chat’s manual toggle. The pending-state Storybook story was visually checked. The combined stack passed the full pre-push Go and frontend suites and production site build; affected validation also passed 308 unit tests and 91 Storybook tests.