react-slick
react-slick copied to clipboard
fix: set slider wrapper key based on children keys passed
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:
- https://github.com/akiran/react-slick/issues/1061#issuecomment-373312134
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:
@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 🙏