FormidableLabs / nuka-carousel

Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
https://commerce.nearform.com/open-source/nuka-carousel
Other
3k stars 596 forks source link

Controlled Carousel using afterSlide and slideIndex results in infinite loop #980

Open panigrah opened 1 year ago

panigrah commented 1 year ago

This was closed in #416 - but still there in latest.

Recreating issue

Sandbox with behavior

https://codesandbox.io/s/inspiring-nightingale-6felod?file=/src/App.js

Am using the latest Nuka 5.4, React 18.2

Describe the Problem

Controlled Carousel ends up in an infinite loop if the "next" and "prev" buttons are clicked really fast.

fritz-c commented 1 year ago

Try with beforeSlide: https://codesandbox.io/s/laughing-tree-gzoru1?file=/src/App.js