fix(app): ignore repeated Enter submits in prompt input (#18148)

Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com>
This commit is contained in:
Andrew Maguire 2026-03-19 13:53:44 +02:00 committed by GitHub
parent 5a0bfa7061
commit f4a9fe29a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1241,6 +1241,20 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
// Note: Shift+Enter is handled earlier, before IME check
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault()
if (event.repeat) return
if (
working() &&
prompt
.current()
.map((part) => ("content" in part ? part.content : ""))
.join("")
.trim().length === 0 &&
imageAttachments().length === 0 &&
commentCount() === 0
) {
return
}
handleSubmit(event)
}
}