Bug
When PromptInputSubmit is in the generating/streaming state it renders with
type="button" instead of type="submit" to act as a stop button. This means
form.querySelector('button[type="submit"]') in PromptInputTextarea returns
null.
The Enter key guard checks submitButton?.disabled, which evaluates to
undefined when submitButton is null — so the guard never fires and
form.requestSubmit() is called anyway, allowing users to submit a new message
while the model is still streaming.
Fix
// before
if (submitButton?.disabled) {
// after
if (!submitButton || submitButton.disabled) {
No submit button in the DOM → we're in stop/generating mode → block submission.
Steps to reproduce
- Send a message and wait for the model to start streaming
- Type anything in the textarea and press Enter
- The form submits mid-stream
Bug
When
PromptInputSubmitis in the generating/streaming state it renders withtype="button"instead oftype="submit"to act as a stop button. This meansform.querySelector('button[type="submit"]')inPromptInputTextareareturnsnull.The Enter key guard checks
submitButton?.disabled, which evaluates toundefinedwhensubmitButtonisnull— so the guard never fires andform.requestSubmit()is called anyway, allowing users to submit a new messagewhile the model is still streaming.
Fix
Steps to reproduce