diff --git a/webview-ui/src/components/chat/AutoApproveMenu.tsx b/webview-ui/src/components/chat/AutoApproveMenu.tsx index f5c62df2af..4162b505d9 100644 --- a/webview-ui/src/components/chat/AutoApproveMenu.tsx +++ b/webview-ui/src/components/chat/AutoApproveMenu.tsx @@ -198,26 +198,30 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => { }} onClick={toggleExpanded}>
e.stopPropagation()}> - + {!hasEnabledOptions ? ( + + { + // Show a message or do nothing + return + }} + /> + + ) : ( { - if (!hasEnabledOptions) { - // Show a message or do nothing - return - } const newValue = !(autoApprovalEnabled ?? false) setAutoApprovalEnabled(newValue) vscode.postMessage({ type: "autoApprovalEnabled", bool: newValue }) }} /> - + )}
({ + alwaysAllowReadOnly, + alwaysAllowWrite, + alwaysAllowExecute, + alwaysAllowBrowser, + alwaysAllowMcp, + alwaysAllowModeSwitch, + alwaysAllowSubtasks, + alwaysAllowFollowupQuestions, + alwaysAllowUpdateTodoList, + }), + [ + alwaysAllowReadOnly, + alwaysAllowWrite, + alwaysAllowExecute, + alwaysAllowBrowser, + alwaysAllowMcp, + alwaysAllowModeSwitch, + alwaysAllowSubtasks, + alwaysAllowFollowupQuestions, + alwaysAllowUpdateTodoList, + ], + ) + + const { hasEnabledOptions } = useAutoApprovalState(autoApprovalToggles, autoApprovalEnabled) + const isAutoApproved = useCallback( (message: ClineMessage | undefined) => { // First check if auto-approval is enabled AND we have at least one permission @@ -966,19 +995,8 @@ const ChatViewComponent: React.ForwardRefRenderFunction
- + {!hasEnabledOptions ? ( + + { + // Do nothing when no options are enabled + return + }} + /> + + ) : ( { - if (!hasEnabledOptions) { - return - } const newValue = !(autoApprovalEnabled ?? false) setAutoApprovalEnabled(newValue) vscode.postMessage({ type: "autoApprovalEnabled", bool: newValue }) }} /> - + )}
{t("settings:sections.autoApprove")}