chore: fix formData should be undefined

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-05-27 15:58:06 +02:00
parent 8cc6ab9372
commit c87dea17c0
2 changed files with 3 additions and 3 deletions
@@ -64,7 +64,7 @@ export interface ScaffolderRJSFFieldProps<
/** The tree of unique ids for every child field */
idSchema: IdSchema<T>;
/** The data for this field */
formData: T;
formData?: T;
/** The tree of errors for this field and its children */
errorSchema?: ErrorSchema<T>;
/** The field change event handler; called with the updated form data and an optional `ErrorSchema` */
@@ -115,7 +115,7 @@ export const MultiEntityPicker = (props: MultiEntityPickerProps) => {
}
// We need to check against formData here as that's the previous value for this field.
if (formData.includes(ref) || allowArbitraryValues) {
if (formData?.includes(ref) || allowArbitraryValues) {
return entityRef;
}
}
@@ -173,7 +173,7 @@ export const MultiEntityPicker = (props: MultiEntityPickerProps) => {
required={required}
InputProps={{
...params.InputProps,
required: formData.length === 0 && required,
required: formData?.length === 0 && required,
}}
/>
)}