Closed RyanAtViceSoftware closed 7 years ago
Per discussion on Reactiflux, this appears to have been another case of accidental mutation. Closing.
Hi there, what does "accidental mutation" mean? I am having a situation where componentWillReceiveProps is not been triggered even though the properties are changing.
@flq Take a look at this and see if it helps: http://redux.js.org/docs/Troubleshooting.html
@flq : Also see http://redux.js.org/docs/faq/ReactRedux.html#react-not-rerendering , http://redux.js.org/docs/faq/ImmutableData.html , http://redux.js.org/docs/recipes/reducers/ImmutableUpdatePatterns.html , and http://redux.js.org/docs/recipes/reducers/PrerequisiteConcepts.html#immutable-data-management .
Oh that, yeah. No, I create a new state. Ive been using this stack a few times, with not too much trouble lately. My problem is not a lack of rendering (the render method is called), but that the props-receive hook for updating internal state is not called. If time permits I'll try to produce a repro tomorrow.
I had initially posted this issue on the redux github here(https://github.com/reactjs/redux/issues/2317) but was advised to move it here.
Do you want to request a feature or report a bug?
bug
What is the current behavior? componentWillReceiveProps is not called even though mapStateToProps returns different values
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar. It'd be hard to create a minimal example here but I can show what's happening in my code. I'm having problems getting
componentWillReceiveProps
to be called reliably in my code. The logging output below is writing out the calls tomapStateToProps
,componentWillReceiveProps
, andrender
and as you can see the final call that I would expect to happen isn't happening even thoughmapStateToProps
is returning state that would be different when using shallow compare.Console Logging
code
What is the expected behavior? That componentWillReceiveProps would be called after the last two calls to mapStateToProps as the result is different.
Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
chrome Version 57.0.2987.110 (64-bit) mac seirra 10.12.3
Haven't tried it in previous versions of Redux