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