"react-router": "4.0.0",
"react-router-dom": "4.0.0"
"react-router-redux": "~5.0.0-alpha.4"
See steps below
ConnectedRouter from react-router-redux:// Currently at /stuff
<ConnectedRouter history={history} />
<Router> // <== returned by <ConnectedRouter>
<Switch>
<Route exact path="/" component={A}/> // <== not rendered
<Route path="/stuff" render={() => <Bundle />}>
<Bundle> // <== Async bundle loader
<Connect(Layout)>
<Layout>
<Switch>
<Route [...stuff] component={BA} />
<Route [...stuff] component={BB} />
<Route [...stuff] component={BC} />
</Switch>
</Layout>
</Connect(Layout)>
</Bundle>
</Route>
<Route path="/more" component={C}/> // <== not rendered
</Switch>
</Router>
</ConnectedRouter>
dispatch(push('/')), etc.Browser should render matched <Route> components
I checked my redux store, and all location states are reflected accurately. BUT, here's what happens:
context.router.history.location and context.router.route.location have different pathnames for the inner Strange - when I passed down props supplied by <Route path="/stuff" render={() => <Bundle />}> into the child of <Bundle> (i.e. <Connect(Layout) {...props} >), it worked. To be clear the props here are match, location, and history.
The connected component was already subscribed to location changes, and its own mapStateToProps was updating correctly. I'm not sure what exactly changed after passing down props mentioned above, but it fixed it.
So, how to fix this now? I am relying on redux-form, which is again relying on connect from redux. So I am not able to change this one...
@iDuuck It really depends on how you structured your component hierarchy. The problem with mine was that the <Bundle> component standing in between <Route> and <Connect()> prevented the updates by not passing props down from <Route> to <Connect()>. I've never used redux-form before, but if your decorated redux form is directly under a <Route> (e.g. <Route path='/path' component={MyForm} />), then I might try to experiment with how to make the wrapped MyForm component aware of <Route>'s changing props.
Most helpful comment
@js3692 https://github.com/ReactTraining/react-router/pull/4757