Browse Source

fix: empty object missing in variable tree (#391)

Yiwei Mao 6 tháng trước cách đây
mục cha
commit
e385211484

+ 0 - 4
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];

+ 1 - 4
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