From 48c4e0a76736ac124a0d6e878f840208f31b8b09 Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Wed, 30 Aug 2023 14:47:31 +0300 Subject: [PATCH] fix(core): don't call `realIndexChange` on initialIndex if runCallbacksOnInit is disalbed fixes #6976 --- src/core/update/updateActiveIndex.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/update/updateActiveIndex.mjs b/src/core/update/updateActiveIndex.mjs index 6e6545c54..27589fbe5 100644 --- a/src/core/update/updateActiveIndex.mjs +++ b/src/core/update/updateActiveIndex.mjs @@ -94,10 +94,11 @@ export default function updateActiveIndex(newActiveIndex) { } swiper.emit('activeIndexChange'); swiper.emit('snapIndexChange'); - if (previousRealIndex !== realIndex) { - swiper.emit('realIndexChange'); - } + if (swiper.initialized || swiper.params.runCallbacksOnInit) { + if (previousRealIndex !== realIndex) { + swiper.emit('realIndexChange'); + } swiper.emit('slideChange'); } }