In connect's bindStoreUpdate method, this.props is bound only once:
Whenever this.subscribeToAllQueries and this.createAllMutationHandlers are called further down in this method due to store state changes, they receive the probably outdated props bound on initialisation instead of the current value of this.props.
Should I prepare a pull request to fix this?
@sgoll do you have a replication that shows the outdated props? We have a few tests to ensure that the correct props are passed to the map functions
@jbaxleyiii Yep, it happens in our current project, which isn't even too complicated (basic Redux store and react-router). I'll write up a minimal example tonight.
@jbaxleyiii I created a minimal test that replicates the behavior; the test fails at line 79 where the original prop value "foo" is passed to mapQueriesToProps again despite not actually having been changed:
https://gist.github.com/sgoll/8519d638feb9489242f517cf954e4681
@sgoll fantastic replication! I'll take a look and try to get a fix out today!
Also thanks so much @sgoll for the fantastic test reproduction!
Fixed via https://github.com/apollostack/react-apollo/pull/70 in 0.3.8
Most helpful comment
@jbaxleyiii I created a minimal test that replicates the behavior; the test fails at line 79 where the original prop value "foo" is passed to
mapQueriesToPropsagain despite not actually having been changed:https://gist.github.com/sgoll/8519d638feb9489242f517cf954e4681