Skip to content

Commit e40294e

Browse files
authored
fix: prevent empty gaps on fast scrolling, fix (#863, #882) (#890)
1 parent 89b8890 commit e40294e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,20 @@ export default {
741741
throw new Error('Rendered items limit reached')
742742
},
743743
744+
isAnyVisibleGap () {
745+
// Check if any view index is not in sequence (detect gaps)
746+
return this.pool
747+
.filter(({ nr }) => nr.used)
748+
.every(({ nr }, i) => i === 0 || nr.index !== this.pool[i - 1].index + 1)
749+
},
750+
744751
sortViews () {
745752
this.pool.sort((viewA, viewB) => viewA.nr.index - viewB.nr.index)
753+
754+
if (this.isAnyVisibleGap()) {
755+
this.updateVisibleItems(false)
756+
clearTimeout(this.$_sortTimer)
757+
}
746758
},
747759
},
748760
}

0 commit comments

Comments
 (0)