mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix: prevent unnecessary MCP server refresh on settings save
- Add state comparison before triggering MCP refresh - Only call handleMcpEnabledChange when mcpEnabled value actually changes - Fixes issue where saving any settings triggers MCP refresh notifications Fixes #6772
This commit is contained in:
parent
c52fdc4397
commit
beeb1a0cf2
1 changed files with 13 additions and 5 deletions
|
|
@ -900,12 +900,20 @@ export const webviewMessageHandler = async (
|
|||
}
|
||||
case "mcpEnabled":
|
||||
const mcpEnabled = message.bool ?? true
|
||||
await updateGlobalState("mcpEnabled", mcpEnabled)
|
||||
const currentMcpEnabled = getGlobalState("mcpEnabled") ?? true
|
||||
|
||||
// Delegate MCP enable/disable logic to McpHub
|
||||
const mcpHubInstance = provider.getMcpHub()
|
||||
if (mcpHubInstance) {
|
||||
await mcpHubInstance.handleMcpEnabledChange(mcpEnabled)
|
||||
// Only update and refresh if the value actually changed
|
||||
if (currentMcpEnabled !== mcpEnabled) {
|
||||
await updateGlobalState("mcpEnabled", mcpEnabled)
|
||||
|
||||
// Delegate MCP enable/disable logic to McpHub
|
||||
const mcpHubInstance = provider.getMcpHub()
|
||||
if (mcpHubInstance) {
|
||||
await mcpHubInstance.handleMcpEnabledChange(mcpEnabled)
|
||||
}
|
||||
} else {
|
||||
// Just update the state without triggering refresh
|
||||
await updateGlobalState("mcpEnabled", mcpEnabled)
|
||||
}
|
||||
|
||||
await provider.postStateToWebview()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue