-
-
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
Render not called when dispatch #87
Comments
Hi @K4stor I have looked into your code, it seems you are mutating your state in your reducer, you are pushing a new entry into operations array instead of creating a new array. See http://rackt.github.io/redux/docs/basics/Reducers.html or http://rackt.github.io/redux/docs/Troubleshooting.html in the first section. Your state needs to be immutable so that re-render is triggered. Hope it helps ! |
Ah ok that makes sense. Thank you very much ! I will try it tomorrow and let you know if it worked |
Just wanted to update the link that Dan posted above, the troubleshooting section has moved and this shows up pretty high in searches: https://github.com/reactjs/react-redux/blob/master/docs/troubleshooting.md#my-views-arent-updating |
Yeah, mutating state is the reason for components not updating like 98% of the time. I've written up an answer on this in my FAQ. It's not merged in yet, so I'll link to the WIP branch: https://github.com/markerikson/redux/blob/merge-faq-page/docs/FAQ.md#why-isnt-my-component-re-rendering-or-my-mapstatetoprops-running |
Hello
I am trying to port my project to Redux.
My components are react already. And I added
everything needed (or at least I think so) to
obey the redux framework.
But my React Component wont re-render even if I use
export default connect(state => state)(WorkspaceView)
The reducer gets called, the state is altred, but nothing happens.
When I force a render manually it works.
I uploaded my project here https://dl.dropboxusercontent.com/u/11300320/PTG.zip , and the component I am writing about is called Workspace view.
Just dload it, run
npm install
gulp
and./run
.It uses electron.io therefore the run command
Please help me !
Regards Carsten
The text was updated successfully, but these errors were encountered: