Reputation: 31
When using the latest version of React-Router-Redux with the latest version of React-Router-Dom and React-Router, the Push dispatch does not work in particular situations. Here are the details:
Versions: "react-redux": "^5.0.7", "react-router-dom": "^4.2.2", react-router "^4.2.0", "react-router-redux": "^5.0.0-alpha.9",
Steps to reproduce: Setup code as per the examples in the React-Router-Redux version 5 repo. Wrapped connect with withRouter as specified in : https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/guides/blocked-updates.md
Expected Behavior Dispatch an action and change the url of the page when a push action is dispatched from a component.
Actual Behavior Url is changed but no action is seen to be dispatched in redux-logger. Action dispatches properly when url is changed manually and set in url bar or navigating using the navigation bar on web site.
Any insights would be appreciated.
Upvotes: 0
Views: 454
Reputation: 31
I figured out the issue with this bug. The issue is you have to define the history used in the store
and the history used in <ConnectedRouter history={history}>
in the same component. So if you define your store in another component other then the component you define ConnectedRouter, you have to pass in the history used in the ConnectedRouter component into your store component.
I am guessing history is slightly different depending on which component you define it in so it was causing syncing issues with the Router.
Upvotes: 2