-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Reuse latest selected state on selector re-run (#1654) #1660
Conversation
Deploy preview for react-redux-docs ready! Built with commit b53d184 |
count: count + 1, | ||
})) | ||
|
||
const alwaysEqual = () => true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also maintain the latest state if the equalityFn is defined within the component or inline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes—it only cares what the equalityFn returns, not what its identity is. However, having a non-pure equalityFn (i.e., one that closes over variables from its surrounding components) could have very surprising results.
Co-authored-by: nightpool <[email protected]>
Seems reasonable, I think. |
I'm encountering the same issue, and this would be a nice fix. Is there something I can do to help with merging this PR? |
Yeah, let's do this. |
I'm not sure if it is a simple fix or a potential breaking change, but reuse latest selected state is quite important in preventing components from re-render frequently