()
| 322 | let isPromptControlled = props.value !== undefined; |
| 323 | let isAttachmentsControlled = props.attachments !== undefined; |
| 324 | let onSubmit = () => { |
| 325 | if (prompt.segments.length === 0) { |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | props.onSubmit?.(prompt, attachments); |
| 330 | if (!isPromptControlled) { |
| 331 | setPrompt(new PromptFieldValue([])); |
| 332 | } |
| 333 | if (!isAttachmentsControlled) { |
| 334 | setAttachments([]); |
| 335 | } |
| 336 | inputRef.current?.focus(); |
| 337 | }; |
| 338 | |
| 339 | return ( |
| 340 | <PromptFieldContext.Provider |
no test coverage detected