diff --git a/extensions/cli/src/ui/components/ToolPermissionSelector.tsx b/extensions/cli/src/ui/components/ToolPermissionSelector.tsx index fcc081799..bd58f9045 100644 --- a/extensions/cli/src/ui/components/ToolPermissionSelector.tsx +++ b/extensions/cli/src/ui/components/ToolPermissionSelector.tsx @@ -64,13 +64,12 @@ export const ToolPermissionSelector: React.FC = ({ }) => { const permissionOptions = getPermissionOptions(); const [selectedIndex, setSelectedIndex] = useState(0); - const [hasShownDangerousCommandWarningOnce] = useState(() => { - const prev = hasShownDangerousCommandWarning; - hasShownDangerousCommandWarning = true; - return prev; - }); + const [initialHasShownDangerousCommand] = useState( + hasShownDangerousCommandWarning, + ); + hasShownDangerousCommandWarning = false; const showDynamicWarning = - hasDynamicEvaluation && !hasShownDangerousCommandWarningOnce; + hasDynamicEvaluation && !initialHasShownDangerousCommand; useInput((input, key) => { if (key.return) {