We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f650006 commit 51656d9Copy full SHA for 51656d9
.changeset/tall-masks-call.md
@@ -0,0 +1,5 @@
1
+---
2
+'@tanstack/virtual-core': patch
3
4
+
5
+fix(core): handle case when item count is less than or equal to lanes
packages/virtual-core/src/index.ts
@@ -1123,6 +1123,14 @@ function calculateRange({
1123
const lastIndex = measurements.length - 1
1124
const getOffset = (index: number) => measurements[index]!.start
1125
1126
+ // handle case when item count is less than or equal to lanes
1127
+ if (measurements.length <= lanes) {
1128
+ return {
1129
+ startIndex: 0,
1130
+ endIndex: lastIndex,
1131
+ }
1132
1133
1134
let startIndex = findNearestBinarySearch(
1135
0,
1136
lastIndex,
0 commit comments