Skip to content

Commit 4e9502d

Browse files
committed
fix(node-children): solve the crash of null in schema.children
1 parent 5738394 commit 4e9502d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/designer/src/document/node/node-children.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class NodeChildren implements INodeChildren {
102102
options: any = {},
103103
) {
104104
makeObservable(this);
105-
this.children = (Array.isArray(data) ? data : [data]).map((child) => {
105+
this.children = (Array.isArray(data) ? data : [data]).filter(child => !!child).map((child) => {
106106
return this.owner.document?.createNode(child, options.checkId);
107107
});
108108
}
@@ -127,7 +127,7 @@ export class NodeChildren implements INodeChildren {
127127
}
128128

129129
import(data?: IPublicTypeNodeData | IPublicTypeNodeData[], checkId = false) {
130-
data = data ? (Array.isArray(data) ? data : [data]) : [];
130+
data = (data ? (Array.isArray(data) ? data : [data]) : []).filter(d => !!d);
131131

132132
const originChildren = this.children.slice();
133133
this.children.forEach((child) => child.internalSetParent(null));

0 commit comments

Comments
 (0)