facebookarchive / redux-react-hook

React Hook for accessing state and dispatch from a Redux store
MIT License
2.16k stars 103 forks source link

Support re-rendering when a Set/Map changes #74

Closed scriptist closed 4 years ago

scriptist commented 4 years ago

The current shallowEqual implementation always returns true when the provided values are both Sets or Maps. This results in components failing to re-render when a Set or Map changes.

To resolve this, I've switched to the fast-equals implementation of shallowEqual, which has built-in support for Sets and Maps.

I've also added a test that confirms this behaviour.

facebook-github-bot commented 4 years ago

Hi scriptist! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

facebook-github-bot commented 4 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

ianobermiller commented 4 years ago

Thanks for the PR! Instead of pulling in another library as opposed to shallowEqual, I propose (#75) we release a new major version of redux-react-hook in which you pass in your own equality comparator. That way you won't be tied to a particular comparison implementation.