Skip to content

Commit 6915369

Browse files
committed
Fix estimateSize will be used as a fallback #207
1 parent 095a5d5 commit 6915369

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/virtual.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ export default class Virtual {
210210
// return a scroll offset from given index, can efficiency be improved more here?
211211
// although the call frequency is very high, its only a superposition of numbers
212212
getIndexOffset (givenIndex) {
213-
// we know this.
214213
if (!givenIndex) {
215214
return 0
216215
}
@@ -220,7 +219,7 @@ export default class Virtual {
220219
for (let index = 0; index < givenIndex; index++) {
221220
// this.__getIndexOffsetCalls++
222221
indexSize = this.sizes.get(this.param.uniqueIds[index])
223-
offset = offset + (indexSize || this.getEstimateSize())
222+
offset = offset + (typeof indexSize === 'number' ? indexSize : this.getEstimateSize())
224223
}
225224

226225
// remember last calculate index

0 commit comments

Comments
 (0)