fix: useAssociationNames (#2714)

This commit is contained in:
katherinehhh 2023-09-25 22:04:20 +08:00 committed by GitHub
parent 291859d6b5
commit e90eec7031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1125,7 +1125,7 @@ export const useAssociationNames = () => {
const isAssociationSubfield = s.name.includes('.');
const isAssociationField =
collectionfield && ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(collectionfield.type);
const isTreeCollection = isAssociationField && getCollection(collectionfield.target).template === 'tree';
const isTreeCollection = isAssociationField && getCollection(collectionfield.target)?.template === 'tree';
if (collectionfield && (isAssociationField || isAssociationSubfield) && s['x-component'] !== 'TableField') {
const fieldPath = !isAssociationField && isAssociationSubfield ? getAssociationPath(s.name) : s.name;
const path = prefix === '' || !prefix ? fieldPath : prefix + '.' + fieldPath;