-
-
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
Since upgrading to v6.0.0, components connected via connectAdvanced are rerendering with unrelated action dispatch #1118
Comments
Please provide a project that reproduces the issue, preferably as a CodeSandbox or RN Snack. Not much we can do otherwise. Couple other items. Can you clarify what specific behavior you're seeing? Can you confirm that your own components are re-rendering? Also, what's your use case for using |
@markerikson will work on a repro, just wanted to get it out there because I noticed in the v6 changelog there was a part that said
so I didn't know if it was simple fix that someone missed. Specifically, my components are rerendering when an action modifies a reducer that my screen is in no way connected to.
If you mean the instance of my component and not just the HOC that connects my component to the store, then yes. Going back to the
Entirely so that I can use forwardRef |
As it turns out, when using connectAdvanced, the developer assumes all responsibility for memoizing the props, which was why my component with rerendering - all the props it was passed was a new reference. |
That, and it seems as if there was some trail of documentation or comments which made it seem as though If you do manage to reconstruct exactly what the sequence was that led you to that conclusion, please let us know so we can improve the docs! |
To preface, between ~80 different screens and ~15 different reducers, I love redux. Major props for all the hard work on v6.
What is the current behavior?
Using React's profiling tool and a snippet I found online:
I noticed that a connected screen and it's list items (list items are also connected components) are rerendering when the action is modifying a completely unrelated reducer. The screen is connected via connectAdvanced, and uses forwardRef, but is rerendering even without the forwardRef. The screen does not rerender when it is connected in a normal fashion
What is the expected behavior?
The connected screen and its children not to rerender when unrelated actions are dispatched.
Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
This is in react-native
The text was updated successfully, but these errors were encountered: