You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some of my Redux reducers I want to simultaneously change the search (i.e. by modifying state.router.location.search and some other state. Since this library advertises "100% one source of truth (store)" and "100% one-way data flow (only dispatch actions!)", I expected this to work.
If the history were like any other react-redux component, this change would propagate from the store and the browser URL would be updated. But instead, the browser URL doesn't change and this becomes out of sync with state.router.
I looked into this and found that the side-effectful calls to history.push etc. happen inside the router middleware. Thus, to do what I wanted I had to write my own middleware which dispatches router events, so they can cause the desired side effects in the router middleware.
Suggestion: instead, what if the router middleware also examined the state after calling next(action), and looked for any change to state.router? If one is found, then it can again do the necessary history calls.
The text was updated successfully, but these errors were encountered:
In some of my Redux reducers I want to simultaneously change the search (i.e. by modifying
state.router.location.search
and some other state. Since this library advertises "100% one source of truth (store)" and "100% one-way data flow (only dispatch actions!)", I expected this to work.If the history were like any other
react-redux
component, this change would propagate from the store and the browser URL would be updated. But instead, the browser URL doesn't change and this becomes out of sync withstate.router
.I looked into this and found that the side-effectful calls to
history.push
etc. happen inside the router middleware. Thus, to do what I wanted I had to write my own middleware which dispatches router events, so they can cause the desired side effects in the router middleware.Suggestion: instead, what if the router middleware also examined the state after calling
next(action)
, and looked for any change tostate.router
? If one is found, then it can again do the necessaryhistory
calls.The text was updated successfully, but these errors were encountered: