diff options
| author | Allen Hutchison <[email protected]> | 2025-05-30 15:16:06 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-30 15:16:06 -0700 |
| commit | 3291ffbe099f2fdc8f88a0c1bb06fb43b65326a9 (patch) | |
| tree | 24aad47d73a9db82a81786da553d8f54fe2edea2 /packages/cli/src | |
| parent | 4225567303a67ba1dec4e5b558df30265926e079 (diff) | |
fix(cli): Clear input buffer before onSubmit in InputPrompt (#633)
Diffstat (limited to 'packages/cli/src')
| -rw-r--r-- | packages/cli/src/ui/components/InputPrompt.tsx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index 730aed48..78426aa3 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -74,8 +74,10 @@ export const InputPrompt: React.FC<InputPromptProps> = ({ const handleSubmitAndClear = useCallback( (submittedValue: string) => { - onSubmit(submittedValue); + // Clear the buffer *before* calling onSubmit to prevent potential re-submission + // if onSubmit triggers a re-render while the buffer still holds the old value. buffer.setText(''); + onSubmit(submittedValue); resetCompletionState(); }, [onSubmit, buffer, resetCompletionState], |
