Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
Include parsed query in all history listener dispatches
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Dail authored and tptee committed Oct 31, 2017
1 parent 2dbd876 commit 207222c
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/enhancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,20 @@ export default ({ history, matchRoute, createMatcher }: EnhancerArgs) => (
matchCache.clear();

const match = currentMatcher(location.pathname);

const payload = {
...location,
...match,
query: qs.parse(location.search)
};
// Other actions come from the user, so they already have a
// corresponding queued navigation action.
if (action === 'POP') {
store.dispatch({
type: POP,
payload: {
// We need to parse the query here because there's no user-facing
// action creator for POP (where we usually parse query strings).
...location,
...match,
query: qs.parse(location.search)
}
payload
});
}

store.dispatch(
locationDidChange({
...location,
...match
})
);
store.dispatch(locationDidChange(payload));
});

return {
Expand Down

0 comments on commit 207222c

Please sign in to comment.