Hide undefineds

This commit is contained in:
Adria Navarro 2024-08-30 14:21:14 +02:00
parent d8744e1b72
commit e9940ce43e
1 changed files with 11 additions and 3 deletions

View File

@ -223,11 +223,19 @@
}
const displayRelationshipFields = relationship => {
const fields = {}
for (const column of Object.entries(schema.columns)
.filter(([_, column]) => column.visible !== false)
.filter(
([key, column]) =>
column.visible !== false &&
relationship[key] !== null &&
relationship[key] !== undefined
)
.map(([key]) => key)) {
relationshipFields ??= {}
relationshipFields[column] = relationship[column]
fields[column] = relationship[column]
}
if (Object.keys(fields).length) {
relationshipFields = fields
}
}