Skip to content

Commit

Permalink
fix: skip parsing children when loop data is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
rainke committed Sep 13, 2023
1 parent d36a037 commit 06f6f5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/renderer-core/src/renderer/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ export default function baseRendererFactory(): IBaseRenderComponent {
}

__getSchemaChildrenVirtualDom = (schema: IPublicTypeNodeSchema | undefined, scope: any, Comp: any, condition = true) => {
let children = condition ? getSchemaChildren(schema): null
let children = condition ? getSchemaChildren(schema) : null;

// @todo 补完这里的 Element 定义 @承虎
let result: any = [];
Expand All @@ -720,6 +720,10 @@ export default function baseRendererFactory(): IBaseRenderComponent {
}

children.forEach((child: any) => {
if (child.loop) {
const childLoop = this.__parseData(child.loop, scope);
if (childLoop.length === 0) return;
}
const childVirtualDom = this.__createVirtualDom(
isJSExpression(child) ? this.__parseExpression(child, scope) : child,
scope,
Expand Down

0 comments on commit 06f6f5a

Please sign in to comment.