Skip to content

Commit 6e56784

Browse files
authored
Remove auto-approve button useMemo (#2630)
1 parent 249d53b commit 6e56784

File tree

2 files changed

+56
-64
lines changed

2 files changed

+56
-64
lines changed

.changeset/blue-papayas-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Remove auto-approve button useMemo

webview-ui/src/components/chat/AutoApproveMenu.tsx

Lines changed: 51 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
2-
import { useCallback, useMemo, useState } from "react"
2+
import { useCallback, useState } from "react"
33
import { Trans } from "react-i18next"
44
import { VSCodeLink } from "@vscode/webview-ui-toolkit/react"
55

@@ -56,69 +56,56 @@ const AutoApproveMenu = ({ style }: AutoApproveMenuProps) => {
5656

5757
const { t } = useAppTranslation()
5858

59-
const actions: AutoApproveAction[] = useMemo(
60-
() => [
61-
{
62-
id: "readFiles",
63-
label: t("chat:autoApprove.actions.readFiles.label"),
64-
enabled: alwaysAllowReadOnly ?? false,
65-
description: t("chat:autoApprove.actions.readFiles.description"),
66-
},
67-
{
68-
id: "editFiles",
69-
label: t("chat:autoApprove.actions.editFiles.label"),
70-
enabled: alwaysAllowWrite ?? false,
71-
description: t("chat:autoApprove.actions.editFiles.description"),
72-
},
73-
{
74-
id: "executeCommands",
75-
label: t("chat:autoApprove.actions.executeCommands.label"),
76-
enabled: alwaysAllowExecute ?? false,
77-
description: t("chat:autoApprove.actions.executeCommands.description"),
78-
},
79-
{
80-
id: "useBrowser",
81-
label: t("chat:autoApprove.actions.useBrowser.label"),
82-
enabled: alwaysAllowBrowser ?? false,
83-
description: t("chat:autoApprove.actions.useBrowser.description"),
84-
},
85-
{
86-
id: "useMcp",
87-
label: t("chat:autoApprove.actions.useMcp.label"),
88-
enabled: alwaysAllowMcp ?? false,
89-
description: t("chat:autoApprove.actions.useMcp.description"),
90-
},
91-
{
92-
id: "switchModes",
93-
label: t("chat:autoApprove.actions.switchModes.label"),
94-
enabled: alwaysAllowModeSwitch ?? false,
95-
description: t("chat:autoApprove.actions.switchModes.description"),
96-
},
97-
{
98-
id: "subtasks",
99-
label: t("chat:autoApprove.actions.subtasks.label"),
100-
enabled: alwaysAllowSubtasks ?? false,
101-
description: t("chat:autoApprove.actions.subtasks.description"),
102-
},
103-
{
104-
id: "retryRequests",
105-
label: t("chat:autoApprove.actions.retryRequests.label"),
106-
enabled: alwaysApproveResubmit ?? false,
107-
description: t("chat:autoApprove.actions.retryRequests.description"),
108-
},
109-
],
110-
[
111-
alwaysAllowReadOnly,
112-
alwaysAllowWrite,
113-
alwaysAllowExecute,
114-
alwaysAllowBrowser,
115-
alwaysAllowMcp,
116-
alwaysAllowModeSwitch,
117-
alwaysAllowSubtasks,
118-
alwaysApproveResubmit,
119-
t,
120-
],
121-
)
59+
const actions: AutoApproveAction[] = [
60+
{
61+
id: "readFiles",
62+
label: t("chat:autoApprove.actions.readFiles.label"),
63+
enabled: alwaysAllowReadOnly ?? false,
64+
description: t("chat:autoApprove.actions.readFiles.description"),
65+
},
66+
{
67+
id: "editFiles",
68+
label: t("chat:autoApprove.actions.editFiles.label"),
69+
enabled: alwaysAllowWrite ?? false,
70+
description: t("chat:autoApprove.actions.editFiles.description"),
71+
},
72+
{
73+
id: "executeCommands",
74+
label: t("chat:autoApprove.actions.executeCommands.label"),
75+
enabled: alwaysAllowExecute ?? false,
76+
description: t("chat:autoApprove.actions.executeCommands.description"),
77+
},
78+
{
79+
id: "useBrowser",
80+
label: t("chat:autoApprove.actions.useBrowser.label"),
81+
enabled: alwaysAllowBrowser ?? false,
82+
description: t("chat:autoApprove.actions.useBrowser.description"),
83+
},
84+
{
85+
id: "useMcp",
86+
label: t("chat:autoApprove.actions.useMcp.label"),
87+
enabled: alwaysAllowMcp ?? false,
88+
description: t("chat:autoApprove.actions.useMcp.description"),
89+
},
90+
{
91+
id: "switchModes",
92+
label: t("chat:autoApprove.actions.switchModes.label"),
93+
enabled: alwaysAllowModeSwitch ?? false,
94+
description: t("chat:autoApprove.actions.switchModes.description"),
95+
},
96+
{
97+
id: "subtasks",
98+
label: t("chat:autoApprove.actions.subtasks.label"),
99+
enabled: alwaysAllowSubtasks ?? false,
100+
description: t("chat:autoApprove.actions.subtasks.description"),
101+
},
102+
{
103+
id: "retryRequests",
104+
label: t("chat:autoApprove.actions.retryRequests.label"),
105+
enabled: alwaysApproveResubmit ?? false,
106+
description: t("chat:autoApprove.actions.retryRequests.description"),
107+
},
108+
]
122109

123110
const toggleExpanded = useCallback(() => {
124111
setIsExpanded((prev) => !prev)

0 commit comments

Comments
 (0)