akiran / react-slick

React carousel component
http://react-slick.neostack.com/
MIT License
11.73k stars 2.1k forks source link

slickPrev not working after refresh starting v0.27.9 #2315

Closed digitalartcrew closed 8 months ago

digitalartcrew commented 9 months ago

Issue

Starting version v0.27.9 slickPrev stop working after refresh. targetSlide values becomes -1 instead of previous slide index. See below:

The screenshots demonstrate a change slide action starting from index 3 in both versions.

Not working as of 0.27.9 0 27 9-slickPrev-after-refresh

Working 0.27.8 and below 0 27 8-slickPrev-after-refresh

It looks like there is a bug here, regardless if lazyload is true/false it will also be overwritten when infinite is false Screenshot 2023-12-20 at 1 13 54 PM

This code was also added when version failed git diff 69348c1 a43f109 Screenshot 2023-12-20 at 4 14 37 PM

digitalartcrew commented 8 months ago

@akiran Would you mind taking a look at this issue? Thanks

akiran commented 8 months ago

This could be because of unnecessary re-renders of Slider when state in a parent component changes.

I am working on a fix and I will make a release soon https://github.com/akiran/react-slick/pull/2331

akiran commented 8 months ago

@digitalartcrew Can you give a code sample to replicate the issue you are facing?

digitalartcrew commented 8 months ago

This could be because of unnecessary re-renders of Slider when state in a parent component changes.

I am working on a fix and I will make a release soon #2331

Thank you very much. It looks like this issue is resolved!