Jelajahi Sumber

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

Yiwei Mao 6 bulan lalu
induk
melakukan
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 || [])
       children = (type.properties || [])
         .map((_property) => renderVariable(_property as VariableField, [...parentFields, variable]))
         .map((_property) => renderVariable(_property as VariableField, [...parentFields, variable]))
         .filter(Boolean) as TreeNodeData[];
         .filter(Boolean) as TreeNodeData[];
-
-      if (!children?.length) {
-        return null;
-      }
     }
     }
 
 
     const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
     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 || [])
       children = (type.properties || [])
         .map((_property) => renderVariable(_property as VariableField, [...parentFields, variable]))
         .map((_property) => renderVariable(_property as VariableField, [...parentFields, variable]))
         .filter(Boolean) as TreeNodeData[];
         .filter(Boolean) as TreeNodeData[];
-
-      if (!children?.length) {
-        return null;
-      }
     }
     }
 
 
     const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
     const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
@@ -76,6 +72,7 @@ export function useVariableTree(params: {
     const isSchemaExclude = excludeSchema
     const isSchemaExclude = excludeSchema
       ? JsonSchemaUtils.isASTMatchSchema(type, excludeSchema)
       ? JsonSchemaUtils.isASTMatchSchema(type, excludeSchema)
       : false;
       : false;
+
     const isSchemaMatch = isSchemaInclude && !isSchemaExclude;
     const isSchemaMatch = isSchemaInclude && !isSchemaExclude;
 
 
     // If not match, and no children, return null
     // If not match, and no children, return null