fix: show cascade select when no data in edit form (#4543)

This commit is contained in:
Katherine 2024-06-03 14:30:18 +08:00 committed by GitHub
parent bd54a01754
commit 1b1930b328
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -311,26 +311,24 @@ export const InternalCascadeSelect = observer(
},
};
return (
props.value !== null && (
<FormProvider form={selectForm}>
{collectionField.interface === 'm2o' ? (
<SchemaComponent
components={{ FormItem }}
schema={{
...fieldSchema,
default: field.value,
title: '',
'x-component': AssociationCascadeSelect,
'x-component-props': {
...props,
},
}}
/>
) : (
<SchemaField schema={schema} />
)}
</FormProvider>
)
<FormProvider form={selectForm}>
{collectionField.interface === 'm2o' ? (
<SchemaComponent
components={{ FormItem }}
schema={{
...fieldSchema,
default: field.value,
title: '',
'x-component': AssociationCascadeSelect,
'x-component-props': {
...props,
},
}}
/>
) : (
<SchemaField schema={schema} />
)}
</FormProvider>
);
},
{ displayName: 'InternalCascadeSelect' },