From 186463abb25419022b566c4741b4ba65cd741096 Mon Sep 17 00:00:00 2001 From: Katherine Date: Wed, 19 Mar 2025 21:01:24 +0800 Subject: [PATCH] fix: association field detection to be based on type (#6506) --- .../schema-component/antd/form-item/FormItem.Settings.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/form-item/FormItem.Settings.tsx b/packages/core/client/src/schema-component/antd/form-item/FormItem.Settings.tsx index 788741a5c2..aefda32ebe 100644 --- a/packages/core/client/src/schema-component/antd/form-item/FormItem.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/form-item/FormItem.Settings.tsx @@ -985,12 +985,11 @@ function useFormItemCollectionField() { export function useIsAssociationField() { const collectionField = useFormItemCollectionField(); - const isAssociationField = ['obo', 'oho', 'o2o', 'o2m', 'm2m', 'm2o', 'updatedBy', 'createdBy', 'mbm'].includes( - collectionField?.interface, - ); + const isAssociationField = + collectionField && + ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany', 'belongsToArray'].includes(collectionField.type); return isAssociationField; } - export function useIsFileField() { const cm = useCollectionManager(); const collectionField = useFormItemCollectionField();