Fix relatedcolumns return type

This commit is contained in:
Adria Navarro 2024-12-30 09:42:55 +01:00
parent 81ed65b099
commit 1714a3cc1d
2 changed files with 7 additions and 8 deletions

View File

@ -26,12 +26,14 @@
const getSchema = (asset, datasource) => {
const schema = getSchemaForDatasource(asset, datasource).schema
// Don't show ID and rev in tables
if (schema) {
delete schema._id
delete schema._rev
if (!schema) {
return
}
// Don't show ID and rev in tables
delete schema._id
delete schema._rev
const result = enrichSchemaWithRelColumns(schema)
return result
}

View File

@ -46,10 +46,7 @@ const columnTypeManyParser = {
export function enrichSchemaWithRelColumns(
schema: Record<string, UIFieldSchema>
): Record<string, UIFieldSchema> | undefined {
if (!schema) {
return
}
): Record<string, UIFieldSchema> {
const result = Object.keys(schema).reduce<Record<string, UIFieldSchema>>(
(result, fieldName) => {
const field = schema[fieldName]