Skip to content

Commit

Permalink
fix(vue): avoid rendering same slide vnode twice for small amount of …
Browse files Browse the repository at this point in the history
…slides in loop + virtual mode (#7556)

Co-authored-by: Artur <art.pipchenko@gmail.com>
  • Loading branch information
artur-pipchenko and p1pchenk0 authored May 28, 2024
1 parent f67308c commit 5737f03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/vue/virtual.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function renderVirtual(swiperRef, slides, virtualData) {
const loopTo = swiperRef.value.params.loop ? slides.length * 2 : slides.length;
const slidesToRender = [];
for (let i = loopFrom; i < loopTo; i += 1) {
if (i >= from && i <= to) {
if (i >= from && i <= to && slidesToRender.length < slides.length) {
slidesToRender.push(slides[getSlideIndex(i)]);
}
}
Expand Down

0 comments on commit 5737f03

Please sign in to comment.