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

Function onSubmit

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

Source from the content-addressed store, hash-verified

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

Callers 1

EditableCellInnerFunction · 0.50

Calls 1

focusMethod · 0.80

Tested by

no test coverage detected