You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple Swiper with navigation elements on a page in Sveltekit. The navigation works fine when the component is initially loaded. But when you leave the page and return to the one with the Swiper element, the navigation elements get multiple click event listeners. From that moment on the navigation does not work as expected as there are multiple click handlers called which results in over jumping pages.
Expected Behavior
Destroying the Swiper component when leaving a page should clean up all listeners on the navigation elements.
Actual Behavior
Duplicated listeners are added and therefore the swiper navigation does not work properly after switching pages.
tonprince
changed the title
Multiple click listeners on navigation elements when changing sveltekit pages
Multiple click event listeners on navigation elements when switching between Sveltekit pages
Sep 8, 2021
It seams when destroying the swiper instance the modules are not cleared. So anytime a new instance of swiper is created when loading the page the modules list is growing:
Check that this is really a bug
Reproduction link
https://codesandbox.io/s/navigation-sveltekit-ctyin?file=/src/routes/index.svelte
Bug description
I have a simple Swiper with navigation elements on a page in Sveltekit. The navigation works fine when the component is initially loaded. But when you leave the page and return to the one with the Swiper element, the navigation elements get multiple click event listeners. From that moment on the navigation does not work as expected as there are multiple click handlers called which results in over jumping pages.
Expected Behavior
Destroying the Swiper component when leaving a page should clean up all listeners on the navigation elements.
Actual Behavior
Duplicated listeners are added and therefore the swiper navigation does not work properly after switching pages.
Swiper version
7.0.3
Platform/Target and Browser Versions
Firefox 91.0.2 (64-bit)
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: