diff --git a/packages/server/src/sdk/app/tables/getters.ts b/packages/server/src/sdk/app/tables/getters.ts index a6bdf62d58..f3e2e97795 100644 --- a/packages/server/src/sdk/app/tables/getters.ts +++ b/packages/server/src/sdk/app/tables/getters.ts @@ -157,6 +157,8 @@ export async function enrichRelationshipSchema( } const relTable = tableCache[field.tableId] + const fieldSchema = field.schema || {} + const resultSchema: Record = {} 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,