From e90eec703132bf5ec59ea94d05ecd737904b934f Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Mon, 25 Sep 2023 22:04:20 +0800 Subject: [PATCH] fix: useAssociationNames (#2714) --- packages/core/client/src/block-provider/hooks/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index 34a499788..e72dca4f0 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -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;