Skip to content

Conversation

tonyanziano
Copy link
Contributor

@tonyanziano tonyanziano commented Mar 5, 2020

…n clicking an activity.

===

Fixes a regression of #1683

===

The problem:

When react-redux's mapStateToProps returns an object with the newest version of a component's props, it does a shallow compare (===) of each of the new props' values with the previous props' values and if any of them return false, then it re-renders the component. Read more here.

Since currentUser was being assigned to a new object ever time mapStateToProps was run, even though the previous currentUser and the new one had the same key/value pairs.

@srinaath
Copy link
Contributor

srinaath commented Mar 5, 2020

Awesome fix @tonyanziano

@tonyanziano tonyanziano merged commit 5ca8253 into master Mar 5, 2020
@tonyanziano tonyanziano deleted the toanzian/card-rerender-fix branch March 5, 2020 00:50
@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 68.154% when pulling e7d0089 on toanzian/card-rerender-fix into e92279e on master.

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.

3 participants