0

I'm witnessing a behavior I fail to understand and that does not seems right.

When I dispatch an action, my components re-render because this.props.location (and others, like params or routeParams) changes, and when I say "changes", I mean the pointer is different, but the inner properties are the same.

The dispatched action does not change the route in any way, just some data in the redux store (on it's own mounted key).

Consequently, shouldComponentUpdate (not overridden) detects a change and forces a re-rendering. But there is no change at all!

That's annoying because I have a setInterval routine that dispatches an action to call the server every 30 seconds to fetch some data. And yet, connected components that does not care about this state change are still re-rendered. The redux panel shows that only this action is dispatched, no LOCATION_CHANGE.

If I unplug react-router-redux (removing the use of syncHistoryWithStore), this behavior stops.

Is this an expected behavior, or did I miss something? I'd like not to have to override shouldComponentUpdate in all of my connected components.

Could you point me where the react router props are being injected in the components?

François G.
  • 247
  • 2
  • 9
  • if your app works without ```react-router-redux```, why do you need it in the first place? are you saying ```location``` changes, but ```LOCATION_CHANGE``` action was not dispatched? – xiaofan2406 Jun 17 '16 at 02:23
  • The 'location' property pointer changes, not the data in it. That's why my components consider there is a change and re-render. – François G. Jun 17 '16 at 08:05

0 Answers0