mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge 18f86e749b into b867ec9145
This commit is contained in:
commit
cc275c0e5a
2 changed files with 11 additions and 2 deletions
|
|
@ -19,6 +19,7 @@ import { useAutoApprovalState } from "@/hooks/useAutoApprovalState"
|
|||
import { useAutoApprovalToggles } from "@/hooks/useAutoApprovalToggles"
|
||||
|
||||
type AutoApproveSettingsProps = HTMLAttributes<HTMLDivElement> & {
|
||||
autoApprovalEnabled?: boolean
|
||||
alwaysAllowReadOnly?: boolean
|
||||
alwaysAllowReadOnlyOutsideWorkspace?: boolean
|
||||
alwaysAllowWrite?: boolean
|
||||
|
|
@ -35,6 +36,7 @@ type AutoApproveSettingsProps = HTMLAttributes<HTMLDivElement> & {
|
|||
allowedMaxCost?: number | undefined
|
||||
deniedCommands?: string[]
|
||||
setCachedStateField: SetCachedStateField<
|
||||
| "autoApprovalEnabled"
|
||||
| "alwaysAllowReadOnly"
|
||||
| "alwaysAllowReadOnlyOutsideWorkspace"
|
||||
| "alwaysAllowWrite"
|
||||
|
|
@ -54,6 +56,7 @@ type AutoApproveSettingsProps = HTMLAttributes<HTMLDivElement> & {
|
|||
}
|
||||
|
||||
export const AutoApproveSettings = ({
|
||||
autoApprovalEnabled,
|
||||
alwaysAllowReadOnly,
|
||||
alwaysAllowReadOnlyOutsideWorkspace,
|
||||
alwaysAllowWrite,
|
||||
|
|
@ -75,10 +78,11 @@ export const AutoApproveSettings = ({
|
|||
const { t } = useAppTranslation()
|
||||
const [commandInput, setCommandInput] = useState("")
|
||||
const [deniedCommandInput, setDeniedCommandInput] = useState("")
|
||||
const { autoApprovalEnabled, setAutoApprovalEnabled } = useExtensionState()
|
||||
const { setAutoApprovalEnabled } = useExtensionState()
|
||||
|
||||
const toggles = useAutoApprovalToggles()
|
||||
|
||||
// Use the prop value (from cached state) for display, but still use context for timer effects
|
||||
const { effectiveAutoApprovalEnabled } = useAutoApprovalState(toggles, autoApprovalEnabled)
|
||||
|
||||
const handleAddCommand = () => {
|
||||
|
|
@ -118,8 +122,10 @@ export const AutoApproveSettings = ({
|
|||
aria-label={t("settings:autoApprove.toggleAriaLabel")}
|
||||
onChange={() => {
|
||||
const newValue = !(autoApprovalEnabled ?? false)
|
||||
// Update cached state for Save button activation
|
||||
setCachedStateField("autoApprovalEnabled", newValue)
|
||||
// Also update context state for immediate timer effect (hybrid approach)
|
||||
setAutoApprovalEnabled(newValue)
|
||||
vscode.postMessage({ type: "autoApprovalEnabled", bool: newValue })
|
||||
}}>
|
||||
<span className="font-medium">{t("settings:autoApprove.enabled")}</span>
|
||||
</VSCodeCheckbox>
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
|
|||
const [cachedState, setCachedState] = useState(() => extensionState)
|
||||
|
||||
const {
|
||||
autoApprovalEnabled,
|
||||
alwaysAllowReadOnly,
|
||||
alwaysAllowReadOnlyOutsideWorkspace,
|
||||
allowedCommands,
|
||||
|
|
@ -350,6 +351,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
|
|||
vscode.postMessage({
|
||||
type: "updateSettings",
|
||||
updatedSettings: {
|
||||
autoApprovalEnabled: autoApprovalEnabled ?? false,
|
||||
language,
|
||||
alwaysAllowReadOnly: alwaysAllowReadOnly ?? undefined,
|
||||
alwaysAllowReadOnlyOutsideWorkspace: alwaysAllowReadOnlyOutsideWorkspace ?? undefined,
|
||||
|
|
@ -766,6 +768,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
|
|||
{/* Auto-Approve Section */}
|
||||
{renderTab === "autoApprove" && (
|
||||
<AutoApproveSettings
|
||||
autoApprovalEnabled={autoApprovalEnabled}
|
||||
alwaysAllowReadOnly={alwaysAllowReadOnly}
|
||||
alwaysAllowReadOnlyOutsideWorkspace={alwaysAllowReadOnlyOutsideWorkspace}
|
||||
alwaysAllowWrite={alwaysAllowWrite}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue