Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set slider wrapper key based on children keys passed #2288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jamessspanggg
Copy link

@jamessspanggg jamessspanggg commented Oct 1, 2023

Context

Currently react-slick does not support dynamic children, where if any of the children is updated after the slider is mounted, the slider does not re-render accordingly. This is due to the wrapper component having it's own key calculation that does not take into account the children's keys that was passed.

In my work, we were facing issues where even the children were updated after mounting, the slider does not re-render the children accordingly. I had to fork the this repo's code to our code and made the changes in this PR in order for it to work.

Some existing issues that reported the same issue:

Solution

Utilise a combination of the children's key for the wrapper, this ensures that if any of the children's key updates, the wrapper knows to re-render accordingly.

Unit tests are all passing after the changes:

Screenshot 2023-10-01 at 7 20 44 PM

@jamessspanggg jamessspanggg marked this pull request as ready for review October 1, 2023 11:16
@jamessspanggg
Copy link
Author

@akiran appreciate it if you could take some time out to look at this fix for the PR as it might help out other people that uses ur package 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant