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

Function onSubmit

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

Source from the content-addressed store, hash-verified

241 let isPromptControlled = props.value !== undefined;
242 let isAttachmentsControlled = props.attachments !== undefined;
243 let onSubmit = () => {
244 if (prompt.segments.length === 0) {
245 return;
246 }
247
248 props.onSubmit?.(prompt, attachments);
249 if (!isPromptControlled) {
250 setPrompt(new PromptFieldValue([]));
251 }
252 if (!isAttachmentsControlled) {
253 setAttachments([]);
254 }
255 inputRef.current?.focus();
256 };
257
258 return (
259 <PromptFieldContext.Provider

Callers 1

EditableCellInnerFunction · 0.50

Calls 1

focusMethod · 0.80

Tested by

no test coverage detected