From fb0cdb704f9f78a5d8a2ae8b2b85db0dbb90026d Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 17 Mar 2023 12:27:35 +0800 Subject: [PATCH] fix(client): cannot read properties of undefined --- packages/core/client/src/block-provider/TableBlockProvider.tsx | 2 +- .../src/schema-component/antd/table-v2/TableBlockDesigner.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/block-provider/TableBlockProvider.tsx b/packages/core/client/src/block-provider/TableBlockProvider.tsx index 3bde23564..a593ebd69 100644 --- a/packages/core/client/src/block-provider/TableBlockProvider.tsx +++ b/packages/core/client/src/block-provider/TableBlockProvider.tsx @@ -96,7 +96,7 @@ export const TableBlockProvider = (props) => { params['sort'] = ['sort']; } let childrenColumnName = 'children'; - if (collection.tree && treeTable !== false) { + if (collection?.tree && treeTable !== false) { if (resourceName.includes('.')) { const f = getCollectionField(resourceName); if (f?.treeChildren) { diff --git a/packages/core/client/src/schema-component/antd/table-v2/TableBlockDesigner.tsx b/packages/core/client/src/schema-component/antd/table-v2/TableBlockDesigner.tsx index cd308e1cb..28fcb6b2b 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/TableBlockDesigner.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/TableBlockDesigner.tsx @@ -39,7 +39,7 @@ export const TableBlockDesigner = () => { const template = useSchemaTemplate(); const collection = useCollection(); const { dragSort, resource } = field.decoratorProps; - const treeChildren = resource.includes('.') ? getCollectionField(resource)?.treeChildren : !!collection?.tree; + const treeChildren = resource?.includes('.') ? getCollectionField(resource)?.treeChildren : !!collection?.tree; const fixedBlockDesignerSetting = useFixedBlockDesignerSetting(); return (