Skip to content

Commit

Permalink
fix(controller): prevent controlled swipers from being called when de…
Browse files Browse the repository at this point in the history
…stroyed (#6501)

fixes #6491
  • Loading branch information
Voidoz committed Mar 20, 2023
1 parent 3177936 commit a266b78
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/modules/controller/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export default function Controller({ swiper, extendParams, on }) {
let controlledTranslate;
const Swiper = swiper.constructor;
function setControlledTranslate(c) {
if (c.destroyed) return;

// this will create an Interpolate function based on the snapGrids
// x is the Grid of the scrolled scroller and y will be the controlled scroller
// it makes sense to create this only once and recall it for the interpolation
Expand Down Expand Up @@ -112,6 +114,8 @@ export default function Controller({ swiper, extendParams, on }) {
const controlled = swiper.controller.control;
let i;
function setControlledTransition(c) {
if (c.destroyed) return;

c.setTransition(duration, swiper);
if (duration !== 0) {
c.transitionStart();
Expand Down

0 comments on commit a266b78

Please sign in to comment.