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
ConnectedRouter is re-rendering when Redux store updates #205
Comments
|
Same bug here, I tried different ways of rendering the component (prop, children prop, render prop) and it does not have any effect. The issue seems to be linked to |
|
@jakewies @merildev this workaround works for me: |
|
@jakewies i cloned your repository to make some tests and try to fix the problem. Looks like the problem was indeed inside the ConnectedRouter component. If you look at the file, in the function Then, it creates a Container Component called What happens is that This is probably what's causing the re-renders. I've forked this repo, switched the |
|
Hey guys! I've opened #208 to hopefully fix this problem 😄 |
|
FWIW I'm getting an
|
|
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. Thank you all for your contributions! |
|
This issue seems to be exist still on 6.4.0. Any help please? |
|
same issue here with 6.4.0. |
|
Same issue here on 6.4.0. |
|
Hello, I am facing the same issue on 6.5.2. Is there any update on this? Thank you |
|
Issue still present on 6.5.2 |
|
Yep, same here (also on 6.5.2) |
|
Issue still present on 6.5.2 |
|
Still seeing this on 6.8.0 |
|
Same issue for me too .. |
|
Still seeing rerenders on 6.8. Any workaround until an official fix comes around? |
|
same issue for me too.. |
|
Still seeing this on 6.9.1 |
|
the issue is still existing 6.9.2 |
I recently migrated from the deprecated
react-router-reduxpackage toconnected-react-routerin order to successfully updatereact-reduxtov6. The migration went well enough thanks to the detailed docs for this project.However, now that I am on
v6.0.0of bothconnected-react-routerandreact-reduxI am noticing some strange things occurring with theConnectedRoutercomponent.First issue
As others have already stated, the
ConnectedRouterseems to be rendering two times on initial page load.Second issue
This is the larger one for me, and I'm still trying to figure out why it is happening. Basically, on any update to the state of my
reduxstore, theConnectedRoutercomponent re-renders, causing unnecessary re-renders of any child components below it.I set up an example repo that you can clone to get more details. I'll give a brief description here:
Description
I've setup my
reduxstore according to the docs in this repository. Assuming this, here is a basic example usingConnectedRouter:The
Homecomponent renders a childIncrementCountcomponent which dispatches an action to increment the count value stored inreduxstore:The
Aboutcomponent renders a childCountValuecomponent which displays the current count:When incrementing the count on the
'/'route, theConnectedRouterre-renders along with theNavcomponent (doesn't even connect to the redux store), and theHomecomponent.This is not the expected behavior.
The expected behavior occurs when replacing
ConnectedRouterwithBrowserRouterfrom thereact-router-domlibrary:In the code above, incrementing the count value on the
'/'route does not cause any unnecessary re-renders to theNavorHomecomponents.The text was updated successfully, but these errors were encountered: