mirror of
https://github.com/cline/cline.git
synced 2026-09-01 15:11:04 +08:00
Fix race condition where MCP servers were sent to webview before it was initialized
This commit is contained in:
@@ -791,6 +791,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
}
|
||||
break
|
||||
}
|
||||
case "fetchLatestMcpServersFromHub": {
|
||||
this.mcpHub?.sendLatestMcpServers()
|
||||
break
|
||||
}
|
||||
case "searchCommits": {
|
||||
const cwd = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0)
|
||||
if (cwd) {
|
||||
|
||||
@@ -472,6 +472,10 @@ export class McpHub {
|
||||
})
|
||||
}
|
||||
|
||||
async sendLatestMcpServers() {
|
||||
await this.notifyWebviewOfServerChanges()
|
||||
}
|
||||
|
||||
// Using server
|
||||
|
||||
// Public methods for server management
|
||||
|
||||
@@ -48,6 +48,7 @@ export interface WebviewMessage {
|
||||
| "silentlyRefreshMcpMarketplace"
|
||||
| "searchCommits"
|
||||
| "showMcpView"
|
||||
| "fetchLatestMcpServersFromHub"
|
||||
// | "relaunchChromeDebugMode"
|
||||
text?: string
|
||||
disabled?: boolean
|
||||
|
||||
@@ -23,6 +23,7 @@ const McpView = ({ onDone }: McpViewProps) => {
|
||||
|
||||
useEffect(() => {
|
||||
vscode.postMessage({ type: "silentlyRefreshMcpMarketplace" })
|
||||
vscode.postMessage({ type: "fetchLatestMcpServersFromHub" })
|
||||
}, [])
|
||||
|
||||
// const [servers, setServers] = useState<McpServer[]>([
|
||||
|
||||
Reference in New Issue
Block a user