From e3852114842780fa87c20c277a7d5f142d310c4f Mon Sep 17 00:00:00 2001 From: Yiwei Mao Date: Thu, 19 Jun 2025 17:03:27 +0800 Subject: [PATCH] fix: empty object missing in variable tree (#391) --- .../src/components/variable-selector/use-variable-tree.tsx | 4 ---- .../src/components/variable-selector/use-variable-tree.tsx | 5 +---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/materials/form-antd-materials/src/components/variable-selector/use-variable-tree.tsx b/packages/materials/form-antd-materials/src/components/variable-selector/use-variable-tree.tsx index 4136d4d4..f2717c82 100644 --- a/packages/materials/form-antd-materials/src/components/variable-selector/use-variable-tree.tsx +++ b/packages/materials/form-antd-materials/src/components/variable-selector/use-variable-tree.tsx @@ -62,10 +62,6 @@ export function useVariableTree(params: { children = (type.properties || []) .map((_property) => renderVariable(_property as VariableField, [...parentFields, variable])) .filter(Boolean) as TreeNodeData[]; - - if (!children?.length) { - return null; - } } const keyPath = [...parentFields.map((_field) => _field.key), variable.key]; diff --git a/packages/materials/form-materials/src/components/variable-selector/use-variable-tree.tsx b/packages/materials/form-materials/src/components/variable-selector/use-variable-tree.tsx index 2cf3838b..ce49df3a 100644 --- a/packages/materials/form-materials/src/components/variable-selector/use-variable-tree.tsx +++ b/packages/materials/form-materials/src/components/variable-selector/use-variable-tree.tsx @@ -61,10 +61,6 @@ export function useVariableTree(params: { children = (type.properties || []) .map((_property) => renderVariable(_property as VariableField, [...parentFields, variable])) .filter(Boolean) as TreeNodeData[]; - - if (!children?.length) { - return null; - } } const keyPath = [...parentFields.map((_field) => _field.key), variable.key]; @@ -76,6 +72,7 @@ export function useVariableTree(params: { const isSchemaExclude = excludeSchema ? JsonSchemaUtils.isASTMatchSchema(type, excludeSchema) : false; + const isSchemaMatch = isSchemaInclude && !isSchemaExclude; // If not match, and no children, return null