swiper icon indicating copy to clipboard operation
swiper copied to clipboard

Slide change event gets fired multiple times when using loop and init false

Open josh-attwood opened this issue 2 years ago • 2 comments

Check that this is really a bug

  • [X] I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-default-forked-rfphws?file=%2Findex.html%3A1%2C1&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clp2rtlqy00083d5uxbs7e9c9%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clp2rtlqy00043d5ut6qkemo0%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clp2rtlqy00053d5uigu99w61%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clp2rtlqy00073d5ujit0fqrc%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clp2rtlqy00043d5ut6qkemo0%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clp2rtlqy00033d5uxtu5r53q%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Findex.html%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522clp2rtlqy00043d5ut6qkemo0%2522%252C%2522activeTabId%2522%253A%2522clp2rtlqy00033d5uxtu5r53q%2522%257D%252C%2522clp2rtlqy00073d5ujit0fqrc%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clp2rtlqy00063d5ugwevv86x%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%2522%257D%255D%252C%2522id%2522%253A%2522clp2rtlqy00073d5ujit0fqrc%2522%252C%2522activeTabId%2522%253A%2522clp2rtlqy00063d5ugwevv86x%2522%257D%252C%2522clp2rtlqy00053d5uigu99w61%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clp2rtlqy00053d5uigu99w61%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

Bug description

The slide change event gets fired multiple times in certain scenarios.

When you have loop: true and loop into the next iteration of the slides the slide change event fires multiple times. This only seems to be an issue when init is set to false and you initialise swiper separately.

Expected Behavior

No response

Actual Behavior

No response

Swiper version

11

Platform/Target and Browser Versions

MacOS Safari 15.6.1

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • [X] 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

josh-attwood avatar Nov 17 '23 15:11 josh-attwood

I also encountered this problem, help

DLLluoluo avatar Sep 24 '24 10:09 DLLluoluo

is any one working on this bug ?

santanacrafted avatar May 12 '25 14:05 santanacrafted