diff --git a/packages/firecms_core/src/util/entities.ts b/packages/firecms_core/src/util/entities.ts index c6a2c5388..17e72b1e1 100644 --- a/packages/firecms_core/src/util/entities.ts +++ b/packages/firecms_core/src/util/entities.ts @@ -40,13 +40,15 @@ export function getDefaultValuesFor>(properties: P if (!properties) return {}; return Object.entries(properties) .map(([key, property]) => { + if (!property) return {}; const value = getDefaultValueFor(property as PropertyOrBuilder); return value === undefined ? {} : { [key]: value }; }) .reduce((a, b) => ({ ...a, ...b }), {}) as EntityValues; } -export function getDefaultValueFor(property: PropertyOrBuilder) { +export function getDefaultValueFor(property?: PropertyOrBuilder) { + if (!property) return undefined; if (isPropertyBuilder(property)) return undefined; if (property.defaultValue || property.defaultValue === null) { return property.defaultValue;