Skip to content

Commit f052d67

Browse files
committed
fix(RecycleScroller): prevent empty gaps fix (Akryum#863, Akryum#882)
1 parent bd83b8b commit f052d67

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

+9
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,17 @@ 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+
this.isAnyVisibleGap() && this.updateVisibleItems(false)
761770
},
762771
},
763772
}

0 commit comments

Comments
 (0)