fix: belongsToArray (#6173)

This commit is contained in:
Zeke Zhang 2025-02-07 11:06:25 +08:00 committed by GitHub
parent 0185ecee4c
commit 554cad3353
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,7 +57,5 @@ export const AssociationProvider: FC<AssociationProviderProps> = (props) => {
*/
export const useAssociationName = () => {
const field = useCollectionField();
return field && ['belongsToMany', 'belongsTo', 'hasMany', 'hasOne'].includes(field.type)
? `${field.collectionName}.${field.name}`
: null;
return field?.target ? `${field.collectionName}.${field.name}` : null;
};