-
Notifications
You must be signed in to change notification settings - Fork 594
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
Infinite re-mounting when dispatching in componentDidMount of a route component #204
Comments
Can you remove the beta and install latest for both this library and react redux? |
Yep sorry, I've tried with @latest of all 3 packages:
Same issue. |
@supasate i am also facing same issue, it's rerendering for inifinity, tried v 5 didn't work at all even |
I have the exact same issue, I'm running the latest version of connected-react-router and react-redux. After a bit of debugging and reading #205 (comment) I changed my Now I didn't stop there, I went back, and tried adding a shouldComponentUpdate method to ConnectedRouter.js's ConnectedRouter Class and made it return false, now using the component prop on That's how far I got, not sure what triggers the update, but something is |
I'm having the same issue, however I cannot seem to resolve it with what @madsmadsen proposed... Any updates? |
Same issue here regarding infinite component mount |
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. |
I'm still getting the issue. Forward button does not seem to work anymore when I hit back. |
@simontong Can you provide a minimal repo that can reproduce the issue? |
I still have this problem🤦♂️ |
@madsmadsen I still have this problem with redux and with react-hooks ( useReducer ) as well
but this solved the problem : Thank you! |
I had the same problem, I suspect the |
I faced this issue when was upgrading from react 16.6 to 16.13.1. Actually I had to upgrade react-redux and as result took the latest version of connected-react-router which is 6.8.0. I fixed it by rolling back to 6.6.1 (the nearest broken is 6.7.0). I checked the changes and noticed that |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
After upgrading to latest connected-react-router and react-redux. When I mount a routed component that does a dispatch inside componentDidMount it gets into an infinite loop until eventually it hits the Maximum update depth exceeded error.
This only seems to happen inside a component that's mounted through a route. I use the
component
prop onRoute
for all components.What is the expected behavior?
It's a simple action. And the action seems to be performed, so it's expected to not re-mount in an infinite loop which is what I believe is going on. The same redux action works on any other component that is a parent of that
Switch
.It also works fine with the standard
Router
fromreact-router-dom
.Which versions and which browser and OS are affected by this issue?
This is with @latest and @next of all 3:
or
I have tried with older versions of react-router and older and latest versions of redux, same issue.
Possible reason
This seems to only happen on a
Route
d component that is inside my second nestedSwitch
. So my current app structure looks like:App.js
And RoutedLayout.js:
So any
Route
component that is rendered in the RoutedLayoutSwitch
will cause this issue if it dispatches fromcomponentDidMount
.The text was updated successfully, but these errors were encountered: