Don't grab sidebar focus in the McpHub (#4548)

This commit is contained in:
Matt Rubens 2025-06-11 09:33:29 -04:00 committed by GitHub
parent bfeb12bfb4
commit e1c48f0698
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1196,21 +1196,7 @@ export class McpHub {
})
// Send sorted servers to webview
// Try to get the currently visible ClineProvider instance first
let targetProvider: ClineProvider | undefined = undefined
try {
// ClineProvider.getInstance() can focus the view if not visible,
// and returns a Promise<ClineProvider | undefined>
const instancePromise = ClineProvider.getInstance()
if (instancePromise) {
targetProvider = await instancePromise
}
} catch (error) {}
// Fallback to the providerRef if getInstance didn't yield a provider
if (!targetProvider) {
targetProvider = this.providerRef.deref()
}
const targetProvider: ClineProvider | undefined = this.providerRef.deref()
if (targetProvider) {
const serversToSend = sortedConnections.map((connection) => connection.server)