From 6254e742162b892f016cfa4fe67e7a4d9b4eb6c6 Mon Sep 17 00:00:00 2001 From: Matt Rubens Date: Thu, 16 Jan 2025 10:14:36 -0500 Subject: [PATCH] More fixes to checkbox state --- .changeset/dull-gifts-rhyme.md | 5 +++++ src/core/webview/ClineProvider.ts | 7 ++++++- webview-ui/src/context/ExtensionStateContext.tsx | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/dull-gifts-rhyme.md diff --git a/.changeset/dull-gifts-rhyme.md b/.changeset/dull-gifts-rhyme.md new file mode 100644 index 0000000..2d7e636 --- /dev/null +++ b/.changeset/dull-gifts-rhyme.md @@ -0,0 +1,5 @@ +--- +"roo-cline": patch +--- + +Another fix to the auto approve menu diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 4af9cb2..9ff3613 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -877,7 +877,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { await this.postStateToWebview() break case "autoApprovalEnabled": - await this.updateGlobalState("autoApprovalEnabled", message.bool) + await this.updateGlobalState("autoApprovalEnabled", message.bool ?? false) await this.postStateToWebview() break case "enhancePrompt": @@ -1644,6 +1644,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { mode, customPrompts, enhancementApiConfigId, + autoApprovalEnabled, } = await this.getState() const allowedCommands = vscode.workspace @@ -1683,6 +1684,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { mode: mode ?? codeMode, customPrompts: customPrompts ?? {}, enhancementApiConfigId, + autoApprovalEnabled: autoApprovalEnabled ?? false, } } @@ -1797,6 +1799,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { modeApiConfigs, customPrompts, enhancementApiConfigId, + autoApprovalEnabled, ] = await Promise.all([ this.getGlobalState("apiProvider") as Promise, this.getGlobalState("apiModelId") as Promise, @@ -1856,6 +1859,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { this.getGlobalState("modeApiConfigs") as Promise | undefined>, this.getGlobalState("customPrompts") as Promise, this.getGlobalState("enhancementApiConfigId") as Promise, + this.getGlobalState("autoApprovalEnabled") as Promise, ]) let apiProvider: ApiProvider @@ -1959,6 +1963,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { modeApiConfigs: modeApiConfigs ?? {} as Record, customPrompts: customPrompts ?? {}, enhancementApiConfigId, + autoApprovalEnabled: autoApprovalEnabled ?? false, } } diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index a82ed02..52fabad 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -93,6 +93,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode mode: codeMode, customPrompts: defaultPrompts, enhancementApiConfigId: '', + autoApprovalEnabled: false, }) const [didHydrateState, setDidHydrateState] = useState(false) const [showWelcome, setShowWelcome] = useState(false)