fix(copilot): fix new task error#4341
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@BugBot review |
PR SummaryLow Risk Overview When creating a new Copilot chat, it now seeds the new chat into the React Query list cache before selecting it, preventing the auto-select effect from immediately clearing the selected Reviewed by Cursor Bugbot for commit 07ee8e5. Bugbot is set up for automated code reviews on this repo. Configure here. |
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 07ee8e5. Configure here.
Greptile SummaryThis PR fixes two related regressions in the copilot chat panel. First, Confidence Score: 5/5Safe to merge — targeted, well-reasoned fix with no new logic risks introduced. Both changes are minimal and directly address the described regressions. The optimistic cache seed correctly matches the CopilotChatListItem shape and is replaced by the server response after loadCopilotChats invalidates. The auto-select tracking order change is a simple guard reordering with no side-effects. No P1 or P0 issues found. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant C as handleCopilotNewChat
participant QC as QueryClient cache
participant S as setCopilotChatId
participant E as autoSelect useEffect
participant API as /api/copilot/chats
U->>C: Click "New Chat"
C->>API: POST /api/copilot/chats
API-->>C: { id: "new-id" }
C->>QC: setQueryData — prepend new chat to list
C->>S: setCopilotChatId("new-id")
C->>QC: invalidateQueries (loadCopilotChats)
Note over E: Effect fires with updated list + copilotChatId set
E->>E: copilotChatId found in list → no deselect
QC-->>E: server refetch arrives, list still contains new chat
E->>E: copilotChatId still set → return early ✓
Reviews (1): Last reviewed commit: "Keep recent copilot chat open on refresh" | Re-trigger Greptile |
Summary
Our recent fixes to copilot chat unintentionally broke the new copilot chat creation logic. Fixed the chat id selection logic so chat id is only set when its loaded.
Type of Change
Testing
Checklist
Screenshots/Videos