mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix(cli): Clear input buffer before onSubmit in InputPrompt (#633)
This commit is contained in:
@@ -74,8 +74,10 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
|||||||
|
|
||||||
const handleSubmitAndClear = useCallback(
|
const handleSubmitAndClear = useCallback(
|
||||||
(submittedValue: string) => {
|
(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('');
|
buffer.setText('');
|
||||||
|
onSubmit(submittedValue);
|
||||||
resetCompletionState();
|
resetCompletionState();
|
||||||
},
|
},
|
||||||
[onSubmit, buffer, resetCompletionState],
|
[onSubmit, buffer, resetCompletionState],
|
||||||
|
|||||||
Reference in New Issue
Block a user