Skip to content

Commit da38d82

Browse files
authored
Fixes multiple lists
I had a list of multiple virtual lists, and when the first list was scrolled over, it continued to update, and resulted in an infinite scrollbar
1 parent 94652ab commit da38d82

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/VirtualList.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ const VirtualList = (options, mapVirtualToProps = defaultMapToVirtualProps) => (
4949
setStateIfNeeded(list, container, items, itemHeight, itemBuffer) {
5050
// get first and lastItemIndex
5151
const state = getVisibleItemBounds(list, container, items, itemHeight, itemBuffer);
52+
53+
if (state.firstItemIndex > state.lastItemIndex) { return; }
5254

5355
if (state !== undefined && (state.firstItemIndex !== this.state.firstItemIndex || state.lastItemIndex !== this.state.lastItemIndex)) {
5456
this.setState(state);

0 commit comments

Comments
 (0)