From 1cb9560663a491644dee247627e77205306da165 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Wed, 5 Nov 2025 18:53:17 +0800 Subject: [PATCH] perf: only check connecting mcp server when it's enabled --- web/src/app/home/plugins/mcp-server/MCPServerComponent.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/src/app/home/plugins/mcp-server/MCPServerComponent.tsx b/web/src/app/home/plugins/mcp-server/MCPServerComponent.tsx index 704e20fc..99ba3a06 100644 --- a/web/src/app/home/plugins/mcp-server/MCPServerComponent.tsx +++ b/web/src/app/home/plugins/mcp-server/MCPServerComponent.tsx @@ -30,10 +30,11 @@ export default function MCPComponent({ }; }, []); - // Check if any server is connecting and start/stop polling accordingly + // Check if any enabled server is connecting and start/stop polling accordingly useEffect(() => { const hasConnecting = installedServers.some( - (server) => server.status === MCPSessionStatus.CONNECTING, + (server) => + server.enable && server.status === MCPSessionStatus.CONNECTING, ); if (hasConnecting && !pollingIntervalRef.current) { @@ -42,7 +43,7 @@ export default function MCPComponent({ fetchInstalledServers(); }, 3000); } else if (!hasConnecting && pollingIntervalRef.current) { - // Stop polling when no server is connecting + // Stop polling when no enabled server is connecting clearInterval(pollingIntervalRef.current); pollingIntervalRef.current = null; }