Skip to content

Commit d9cc1d4

Browse files
committed
fix(empty gaps): prevent empty gaps on fast scrolling, fix (Akryum#863, Akryum#882)
1 parent bd83b8b commit d9cc1d4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/vue-virtual-scroller/src/components/RecycleScroller.vue

+12
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,20 @@ export default {
756756
throw new Error('Rendered items limit reached')
757757
},
758758
759+
isAnyVisibleGap () {
760+
// Check if any view index is not in sequence (detect gaps)
761+
return this.pool
762+
.filter(({ nr }) => nr.used)
763+
.every(({ nr }, i) => i === 0 || nr.index !== this.pool[i - 1].index + 1)
764+
},
765+
759766
sortViews () {
760767
this.pool.sort((viewA, viewB) => viewA.nr.index - viewB.nr.index)
768+
769+
if (this.isAnyVisibleGap()) {
770+
this.updateVisibleItems(false)
771+
clearTimeout(this.$_sortTimer)
772+
}
761773
},
762774
},
763775
}

0 commit comments

Comments
 (0)