mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
fix(node-children): solve the crash of null in schema.children
This commit is contained in:
parent
5738394a2e
commit
942972c593
@ -102,7 +102,7 @@ export class NodeChildren implements INodeChildren {
|
|||||||
options: any = {},
|
options: any = {},
|
||||||
) {
|
) {
|
||||||
makeObservable(this);
|
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);
|
return this.owner.document?.createNode(child, options.checkId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ export class NodeChildren implements INodeChildren {
|
|||||||
}
|
}
|
||||||
|
|
||||||
import(data?: IPublicTypeNodeData | IPublicTypeNodeData[], checkId = false) {
|
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();
|
const originChildren = this.children.slice();
|
||||||
this.children.forEach((child) => child.internalSetParent(null));
|
this.children.forEach((child) => child.internalSetParent(null));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user