From e587115d62ba27d84b8b8b89a2fe7d71601c0045 Mon Sep 17 00:00:00 2001 From: pashpashpash Date: Mon, 17 Feb 2025 20:33:25 -0800 Subject: [PATCH] added silent fetching to when mcp view is clicked --- webview-ui/src/components/mcp/McpView.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webview-ui/src/components/mcp/McpView.tsx b/webview-ui/src/components/mcp/McpView.tsx index 4e7d2b0da9..e1da3dff71 100644 --- a/webview-ui/src/components/mcp/McpView.tsx +++ b/webview-ui/src/components/mcp/McpView.tsx @@ -1,5 +1,5 @@ import { VSCodeButton, VSCodeLink, VSCodePanels, VSCodePanelTab, VSCodePanelView } from "@vscode/webview-ui-toolkit/react" -import { useState } from "react" +import { useState, useEffect } from "react" import { vscode } from "../../utils/vscode" import { useExtensionState } from "../../context/ExtensionStateContext" import { McpServer } from "../../../../src/shared/mcp" @@ -18,11 +18,12 @@ const McpView = ({ onDone }: McpViewProps) => { const handleTabChange = (tab: string) => { setActiveTab(tab) - if (tab === "marketplace") { - vscode.postMessage({ type: "silentlyRefreshMcpMarketplace" }) - } } + useEffect(() => { + vscode.postMessage({ type: "silentlyRefreshMcpMarketplace" }) + }, []) + // const [servers, setServers] = useState([ // // Add some mock servers for testing // {