Don't include primary display columns by default

This commit is contained in:
Adria Navarro 2024-08-22 16:59:47 +02:00
parent ca0ea3faf8
commit 84bab434bf
1 changed files with 3 additions and 4 deletions

View File

@ -157,6 +157,8 @@ export async function enrichRelationshipSchema(
}
const relTable = tableCache[field.tableId]
const fieldSchema = field.schema || {}
const resultSchema: Record<string, RelationSchemaField> = {}
for (const relTableFieldName of Object.keys(relTable.schema)) {
@ -169,10 +171,7 @@ export async function enrichRelationshipSchema(
continue
}
const isPrimaryDisplay = relTableFieldName === relTable.primaryDisplay
const isReadonly =
isPrimaryDisplay ||
!!(field.schema && field.schema[relTableFieldName]?.readonly)
const isReadonly = !!fieldSchema[relTableFieldName]?.readonly
resultSchema[relTableFieldName] = {
visible: isReadonly,
readonly: isReadonly,