We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 279a464 commit 366031eCopy full SHA for 366031e
1 file changed
src/blocks/carousel/view.ts
@@ -237,13 +237,16 @@ store( 'rt-carousel/carousel', {
237
viewport[ EMBLA_KEY ] = embla;
238
239
const updateState = () => {
240
+ const scrollSnapList = embla.scrollSnapList();
241
context.initialized = true;
242
context.canScrollPrev = embla.canScrollPrev();
243
context.canScrollNext = embla.canScrollNext();
244
context.selectedIndex = embla.selectedScrollSnap();
- context.scrollSnaps = embla
245
- .scrollSnapList()
246
- .map( ( _, index ) => ( { index } ) );
+ if ( context.scrollSnaps.length !== scrollSnapList.length ) {
+ context.scrollSnaps = scrollSnapList.map( ( _, index ) => ( {
247
+ index,
248
+ } ) );
249
+ }
250
context.scrollProgress = embla.scrollProgress();
251
context.slideCount = embla.slideNodes().length;
252
};
0 commit comments