-
-
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
Component no longer updating with react-redux 6.0.0 #1125
Comments
Hmm. Code seems reasonable at first glance. I'll try to take a look at this over the next day or two. |
Same here |
Same thing. The root component completely ignores updates of Redux store. The re-rendering happens only on changes by connected-react-router @@router/LOCATION_CHANGE. So that I have to click twice on a link for a page to be rendered. In my case I have a root component connected to the store and a child one connected to the store as well. I guess the problem somehow related to the new React context API that react-redux is now using. If new API will lead to that there will be no more a possibility for nested connected components, that is definitely a bad news. |
@AgentCoop: please provide a sample project that demonstrates the issue. |
I made a demo for the bug that I think @AgentCoop is talking about: https://github.com/mjhoffm2/react-demo/tree/react-redux-bug-demo-2/node If you run the code in this branch, you can open your browser directly to http://localhost:3000/channels/1/view and you should see the channel list stuck in "loading...". However, if you click the close link or the close button, that will dispatch a route change action through connected-react-router which will cause the channel list to update. |
Huh. I'm looking at this, and I'm pretty confused.
But... the context consumer render callbacks in the connected components aren't firing at all when that re-render happens. checking.. AHA! You have mismatched versions of If I update both to ALWAYS KEEP YOUR REACT VERSIONS IN SYNC! Bad things will happen if you don't :) |
Thanks a ton, I knew it had to be something simple that I overlooked. I wish React printed a warning in the console if there is a version mismatch. |
Agreed. Probably worth filing an issue over there to ask for it. |
You are a god @markerikson ... my issue was in a mono repository of both react and native. React web app working fine, then I tried to apply redux in a new native app, not working, same problem as stated above ... for some reason, the repo was updated with latest React version, but the native version was asking for another version 😆 I even tried subscribing the store, working fine ... I couldnt understand what was going on ... After a few hours and lots of interwebz searching, I found your answer, thanks a lot dude! |
Hey, I had the same problem mapStateToProps doesn't get called a second time on production mode with Expo. This start happening to me with SDK33 having the correct versions of |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
The current behavior is that my react component is not getting updated after I update the redux store. In fact, mapStateToProps is not getting called except for the initial mount.
Here is a fairly minimal repo I set up that reproduces the issue: https://github.com/mjhoffm2/react-demo/tree/react-redux-bug-demo/node
In this demo, the
ChannelList
component dispatches aLOAD_CHANNELS
action when it mounts, which updateschannels
in the redux store. However,mapStateToProps
doesn't get called a second time. I need to force my component to remount by changing the key from the parent to see the updated data.What is the expected behavior?
The expected behavior is that my component will be updated when the redux store is updated. This works as intended if I switch to using react-redux 5.1.1, but does not work when I use version 6.0.0. Even if I call
this.forceUpdate();
in my component, it does not get the new data from the redux store.Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
I am using Redux 4.0.0 and Google Chrome. I have not tested previous versions of Redux, but this has worked with previous versions of React-Redux.
The text was updated successfully, but these errors were encountered: