fix(SchemaInitializer): avoid crashing
This commit is contained in:
parent
97f06d03d3
commit
b6a6431c6f
@ -141,10 +141,10 @@ const lazyLoadChildren = ({
|
|||||||
<LoadingItem
|
<LoadingItem
|
||||||
loadMore={() => {
|
loadMore={() => {
|
||||||
beforeLoading?.();
|
beforeLoading?.();
|
||||||
item._allChildren = item.loadChildren({ searchValue });
|
item._allChildren = item.loadChildren({ searchValue }) || [];
|
||||||
item._count += minStep;
|
item._count += minStep;
|
||||||
item.children = item._allChildren?.slice(0, item._count);
|
item.children = item._allChildren.slice(0, item._count);
|
||||||
if (item.children?.length < item._allChildren?.length) {
|
if (item.children.length < item._allChildren.length) {
|
||||||
addLoading(item, searchValue);
|
addLoading(item, searchValue);
|
||||||
}
|
}
|
||||||
afterLoading?.({ currentCount: item._count });
|
afterLoading?.({ currentCount: item._count });
|
||||||
@ -168,7 +168,7 @@ const lazyLoadChildren = ({
|
|||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
item._count = minStep;
|
item._count = minStep;
|
||||||
beforeLoading?.();
|
beforeLoading?.();
|
||||||
item._allChildren = item.loadChildren({ searchValue: value });
|
item._allChildren = item.loadChildren({ searchValue: value }) || [];
|
||||||
|
|
||||||
if (isEmpty(item._allChildren)) {
|
if (isEmpty(item._allChildren)) {
|
||||||
item.children = [
|
item.children = [
|
||||||
@ -178,10 +178,10 @@ const lazyLoadChildren = ({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
item.children = item._allChildren?.slice(0, item._count);
|
item.children = item._allChildren.slice(0, item._count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.children?.length < item._allChildren?.length) {
|
if (item.children.length < item._allChildren.length) {
|
||||||
addLoading(item, value);
|
addLoading(item, value);
|
||||||
}
|
}
|
||||||
afterLoading?.({ currentCount: item._count });
|
afterLoading?.({ currentCount: item._count });
|
||||||
@ -351,7 +351,8 @@ SchemaInitializer.Button = observer(
|
|||||||
children: isEmpty(item.children) ? [] : renderItems(item.children),
|
children: isEmpty(item.children) ? [] : renderItems(item.children),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.filter(Boolean);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
Loading…
Reference in New Issue
Block a user