fix(ui) Live update resources in resource main view#3617
fix(ui) Live update resources in resource main view#3617TheodoreSpeaks merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Refactors resource parsing into a new Written by Cursor Bugbot for commit d828160. This will update automatically on new commits. Configure here. |
Greptile SummaryThis PR fixes live-update behavior for resources (files, tables, knowledge bases, workflows) displayed in the resource main view after Mothership chat tool calls modify them. The core fix is hooking into the existing Key changes:
Minor concerns found: the Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant useChat
participant SSEStream
participant extractResourcesFromToolResult
participant invalidateResourceQueries
participant ReactQueryCache
User->>useChat: sendMessage()
useChat->>SSEStream: POST /api/copilot/chat
SSEStream-->>useChat: tool_call event (tool_name, id, args)
Note over useChat: isResourceToolName(name)?<br/>Store args in toolArgsMap
SSEStream-->>useChat: tool_result event (id, output, success)
useChat->>useChat: Update tc.status = 'success'
useChat->>extractResourcesFromToolResult: (toolName, params, output)
extractResourcesFromToolResult-->>useChat: [{ type, id, title }, ...]
loop For each resource
useChat->>invalidateResourceQueries: (qc, workspaceId, type, id)
invalidateResourceQueries->>ReactQueryCache: invalidateQueries(lists())
invalidateResourceQueries->>ReactQueryCache: invalidateQueries(detail(id))
end
ReactQueryCache-->>User: UI re-renders with fresh data
SSEStream-->>useChat: resource_added event (optional)
useChat->>invalidateResourceQueries: (second call, same resource)
invalidateResourceQueries->>ReactQueryCache: invalidateQueries again (redundant)
Last reviewed commit: 90650be |
* Live update resources in resource main view * Stop updating on read tool calls --------- Co-authored-by: Theodore Li <theo@sim.ai>
Summary
Mothership changes to resources should live update those resources.
Fixes #(issue)
Type of Change
Testing
Validated files, kbs, tables all live update when changes are made
Checklist
Screenshots/Videos