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
Weird renders on connected Components #211
Comments
It should be fixed in v6.1.0. Please let me know if it helps and feel free to re-open this issue if the problem still exists. |
Hey there and happy new year! Your changes fixed my issue partially. Now the components don't re-render on every redux action, but they do re-render on the I made a change to my previous example and instead of manually firing a To validate that, please revisit the following link: ---> https://codesandbox.io/s/yv7yqkx6nz and click on the "click me" link. You will see the "rendered" message being fired in the console all the time. This behaviour is not there if i replace I believe this has to do with this comment: #208 (comment) Let me know, Cheers :) P.S. I can't re-open an issue, when I wasn't the one to close it. Let me know if you want me to create a separate issue |
@3nvi issue could be solved with using Change your component's code to the following:
In console you will see "rendered" message only once |
@afitiskin Hey there, the thing is that under the hood
|
I'm getting the same issue.
|
This causes |
Okkay Strict Mode..
|
There is a strange bug that appears when i switch from a normal
<Router>
to a<ConnectedRouter>
.Whenever a component is connected, the
ConnectedRouter
(as mentioned in other issues) re-renders on every store update, but another weird issue occurs that i really can't pin it down to something particular.What happens is that, when a random action is fired, any component that is
connect
-ed renders again, without the wrappingconnect
HOC actually rendering. What i mean is that in this scenario:the
Connect(MyComponent)
(the HOC returned fromconnect
) doesn't render, but theMyComponent
does. Thus what i end up with, is that on every redux action that changes the global state, every component that is wrapped withconnect()
will render again regardless of the props it has or has subscribed to.You can find a a codesandbox version of what I'm describing (using your example configuration) here:
--- > https://codesandbox.io/s/yv7yqkx6nz
As you can see, every time
MyComponent
renders it prints the word "rendered". If i dispatch a dummy actionwindow.store.dispatch({ type: "" });
thenMyComponent
renders (although it shouldn't). If I keep everything as is, but simply replaceConnectedRouter
withRouter
, thenMyComponent
doesn't re-render (which is correct since it's not dependant on any state from redux).I'm not mistaken this is a performance bug for any app that uses this package.
Let me know :)
The text was updated successfully, but these errors were encountered: