fix(mcp): scope tools loading state to each server's own query#5441
Conversation
Server rows derived "Loading..." from a workspace-wide isLoading/isFetching aggregate instead of that server's own per-server query, so a row could sit stuck on "Loading..." (or flicker back to it) whenever any other server's tool query was fetching, only clearing after a full page reload.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview
Reviewed by Cursor Bugbot for commit 4d257aa. Configure here. |
Greptile SummaryThis PR fixes a cross-server loading-state contamination bug in the MCP settings UI where a single slow server query caused all other server rows to stay stuck on "Loading..." until a full page refresh. The fix is well-scoped: the per-server
Confidence Score: 5/5Safe to merge — the change is a targeted, well-reasoned fix with no new external dependencies and correct handling of edge cases (disabled servers, workspace switches, stale-data placeholder). The index-aligned zip between No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[useMcpServers] -->|servers list| B[serverIds memo]
B -->|one query per ID| C[useQueries N parallel fetches]
C -->|index-aligned results| D{useMemo aggregator}
D --> E[toolsStateByServer Map]
D --> F[data: McpTool flat list]
E --> H[mcp.tsx filteredServers.map]
F --> H
H -->|.get server.id| I[Per-row isLoadingTools]
I --> J[ServerListItem]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[useMcpServers] -->|servers list| B[serverIds memo]
B -->|one query per ID| C[useQueries N parallel fetches]
C -->|index-aligned results| D{useMemo aggregator}
D --> E[toolsStateByServer Map]
D --> F[data: McpTool flat list]
E --> H[mcp.tsx filteredServers.map]
F --> H
H -->|.get server.id| I[Per-row isLoadingTools]
I --> J[ServerListItem]
Reviews (1): Last reviewed commit: "fix(mcp): scope tools loading state to e..." | Re-trigger Greptile |
Summary
isLoading || isFetchingaggregate across every server's tool query, instead of that specific server's own query — so a row could stay stuck (or flicker back) showing "Loading..." while its tools had actually already resolved, whenever any other server's query was fetching. Only a full page refresh cleared it.useMcpToolsQuerynow zips its per-serveruseQueriesresults with theirserverIds into atoolsStateByServermap (replacing the previously unusedperServerarray), giving each row its ownisLoading/isFetching/error.mcp.tsxreads each row's loading state fromtoolsStateByServer.get(server.id)instead of the global aggregate.Type of Change
Testing
Tested manually;
bun run type-check,bunx biome check, andbun run check:react-querypass on the changed files.Checklist