MCPcopy Create free account
hub / github.com/adobe/react-spectrum / onSubmit

Function onSubmit

packages/@react-spectrum/ai/src/PromptField.tsx:388–402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

386 let isPromptControlled = props.value !== undefined;
387 let isAttachmentsControlled = props.attachments !== undefined;
388 let onSubmit = () => {
389 if (prompt.segments.length === 0 && attachments.length === 0) {
390 return;
391 }
392
393 props.onSubmit?.(prompt, attachments);
394 voiceStopRef.current?.();
395 if (!isPromptControlled) {
396 setPrompt(new PromptFieldValue([]));
397 }
398 if (!isAttachmentsControlled) {
399 setAttachments([]);
400 }
401 inputRef.current?.focus();
402 };
403
404 return (
405 <PromptFieldContext.Provider

Callers 1

EditableCellInnerFunction · 0.50

Calls 2

focusMethod · 0.80
currentMethod · 0.45

Tested by

no test coverage detected