Remove auto-approve button useMemo (#2630)

This commit is contained in:
Chris Estreich 2025-04-14 23:11:13 -07:00 committed by GitHub
parent 249d53b30d
commit 6e567845cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 56 additions and 64 deletions

View file

@ -0,0 +1,5 @@
---
"roo-cline": patch
---
Remove auto-approve button useMemo

View file

@ -1,5 +1,5 @@
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
import { useCallback, useMemo, useState } from "react"
import { useCallback, useState } from "react"
import { Trans } from "react-i18next"
import { VSCodeLink } from "@vscode/webview-ui-toolkit/react"
@ -56,69 +56,56 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
const { t } = useAppTranslation()
const actions: AutoApproveAction[] = useMemo(
() => [
{
id: "readFiles",
label: t("chat:autoApprove.actions.readFiles.label"),
enabled: alwaysAllowReadOnly ?? false,
description: t("chat:autoApprove.actions.readFiles.description"),
},
{
id: "editFiles",
label: t("chat:autoApprove.actions.editFiles.label"),
enabled: alwaysAllowWrite ?? false,
description: t("chat:autoApprove.actions.editFiles.description"),
},
{
id: "executeCommands",
label: t("chat:autoApprove.actions.executeCommands.label"),
enabled: alwaysAllowExecute ?? false,
description: t("chat:autoApprove.actions.executeCommands.description"),
},
{
id: "useBrowser",
label: t("chat:autoApprove.actions.useBrowser.label"),
enabled: alwaysAllowBrowser ?? false,
description: t("chat:autoApprove.actions.useBrowser.description"),
},
{
id: "useMcp",
label: t("chat:autoApprove.actions.useMcp.label"),
enabled: alwaysAllowMcp ?? false,
description: t("chat:autoApprove.actions.useMcp.description"),
},
{
id: "switchModes",
label: t("chat:autoApprove.actions.switchModes.label"),
enabled: alwaysAllowModeSwitch ?? false,
description: t("chat:autoApprove.actions.switchModes.description"),
},
{
id: "subtasks",
label: t("chat:autoApprove.actions.subtasks.label"),
enabled: alwaysAllowSubtasks ?? false,
description: t("chat:autoApprove.actions.subtasks.description"),
},
{
id: "retryRequests",
label: t("chat:autoApprove.actions.retryRequests.label"),
enabled: alwaysApproveResubmit ?? false,
description: t("chat:autoApprove.actions.retryRequests.description"),
},
],
[
alwaysAllowReadOnly,
alwaysAllowWrite,
alwaysAllowExecute,
alwaysAllowBrowser,
alwaysAllowMcp,
alwaysAllowModeSwitch,
alwaysAllowSubtasks,
alwaysApproveResubmit,
t,
],
)
const actions: AutoApproveAction[] = [
{
id: "readFiles",
label: t("chat:autoApprove.actions.readFiles.label"),
enabled: alwaysAllowReadOnly ?? false,
description: t("chat:autoApprove.actions.readFiles.description"),
},
{
id: "editFiles",
label: t("chat:autoApprove.actions.editFiles.label"),
enabled: alwaysAllowWrite ?? false,
description: t("chat:autoApprove.actions.editFiles.description"),
},
{
id: "executeCommands",
label: t("chat:autoApprove.actions.executeCommands.label"),
enabled: alwaysAllowExecute ?? false,
description: t("chat:autoApprove.actions.executeCommands.description"),
},
{
id: "useBrowser",
label: t("chat:autoApprove.actions.useBrowser.label"),
enabled: alwaysAllowBrowser ?? false,
description: t("chat:autoApprove.actions.useBrowser.description"),
},
{
id: "useMcp",
label: t("chat:autoApprove.actions.useMcp.label"),
enabled: alwaysAllowMcp ?? false,
description: t("chat:autoApprove.actions.useMcp.description"),
},
{
id: "switchModes",
label: t("chat:autoApprove.actions.switchModes.label"),
enabled: alwaysAllowModeSwitch ?? false,
description: t("chat:autoApprove.actions.switchModes.description"),
},
{
id: "subtasks",
label: t("chat:autoApprove.actions.subtasks.label"),
enabled: alwaysAllowSubtasks ?? false,
description: t("chat:autoApprove.actions.subtasks.description"),
},
{
id: "retryRequests",
label: t("chat:autoApprove.actions.retryRequests.label"),
enabled: alwaysApproveResubmit ?? false,
description: t("chat:autoApprove.actions.retryRequests.description"),
},
]
const toggleExpanded = useCallback(() => {
setIsExpanded((prev) => !prev)