fix: properly renders custom field components
This commit is contained in:
@@ -67,7 +67,7 @@ export const RenderField: React.FC<Props> = ({
|
||||
|
||||
const DefaultField = isHidden ? HiddenInput : fieldComponents[type]
|
||||
|
||||
if (!CustomField && !DefaultField) {
|
||||
if (CustomField === undefined && !DefaultField) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export const RenderField: React.FC<Props> = ({
|
||||
schemaPath={schemaPath}
|
||||
siblingPermissions={siblingPermissions}
|
||||
>
|
||||
{CustomField || <DefaultField {...fieldComponentProps} />}
|
||||
{CustomField !== undefined ? CustomField : <DefaultField {...fieldComponentProps} />}
|
||||
</FieldPropsProvider>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -63,7 +63,9 @@ export const mapFields = (args: {
|
||||
|
||||
const result: FieldMap = fieldSchema.reduce((acc, field): FieldMap => {
|
||||
const fieldIsPresentational = fieldIsPresentationalOnly(field)
|
||||
let CustomFieldComponent: React.ComponentType<FieldComponentProps>
|
||||
let CustomFieldComponent: React.ComponentType<FieldComponentProps> =
|
||||
field.admin?.components?.Field
|
||||
|
||||
const CustomCellComponent = field.admin?.components?.Cell
|
||||
|
||||
const isHidden = field?.admin && 'hidden' in field.admin && field.admin.hidden
|
||||
|
||||
@@ -165,4 +165,4 @@
|
||||
"app/**/*.tsx",
|
||||
"scripts/**/*.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user