Skip to content

Commit

Permalink
fix(node-children): solve the crash of null in schema.children
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping committed Aug 15, 2023
1 parent 5738394 commit 4e9502d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/designer/src/document/node/node-children.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class NodeChildren implements INodeChildren {
options: any = {},
) {
makeObservable(this);
this.children = (Array.isArray(data) ? data : [data]).map((child) => {
this.children = (Array.isArray(data) ? data : [data]).filter(child => !!child).map((child) => {
return this.owner.document?.createNode(child, options.checkId);
});
}
Expand All @@ -127,7 +127,7 @@ export class NodeChildren implements INodeChildren {
}

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

const originChildren = this.children.slice();
this.children.forEach((child) => child.internalSetParent(null));
Expand Down

0 comments on commit 4e9502d

Please sign in to comment.