Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual + loop with amount of slides less or equal to 3 leads to rendering duplicates #7557

Closed
6 tasks done
artur-pipchenko opened this issue May 26, 2024 · 0 comments
Closed
6 tasks done
Labels

Comments

@artur-pipchenko
Copy link
Contributor

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/devbox/swiper-vue-virtual-slides-forked-v5kyft

Bug description

when we pass props :virtual="true" and :loop="true" with small amount of slides, we get duplicates due to the logic of creating an array of rendered elements. If this amount is less than or equal to 3, logic still tries to create an array of 4 elements, which leads to one element always be a duplicate. Hence we receive warning in console, and DOM tree starts to grow with each swipe

image

Expected Behavior

No duplicate warnings in console

Actual Behavior

Warning about duplicates when sliding left/right and continuosly growing list of DOM elements representing slides

Swiper version

11.1.3

Platform/Target and Browser Versions

Chrome 125.0.6422.77

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant