diff options
author | Noah Loomans <noahloomans@gmail.com> | 2018-07-06 16:14:30 +0200 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2018-07-06 16:14:30 +0200 |
commit | ebb14ffc54670c8e2cbeba18eac238965eee4e81 (patch) | |
tree | d411ba6066a0ee4f38e85a6327456b9b4bc4b13b /src/client/react/store/actions.js | |
parent | 9f935565ebe09444b7b576b0be986c6271baef39 (diff) |
client: Simplify setUser
Diffstat (limited to 'src/client/react/store/actions.js')
-rw-r--r-- | src/client/react/store/actions.js | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/client/react/store/actions.js b/src/client/react/store/actions.js index 36dc748..2d2cd30 100644 --- a/src/client/react/store/actions.js +++ b/src/client/react/store/actions.js @@ -4,18 +4,10 @@ import withinRange from '../lib/withinRange'; export function setUser(newUser) { return (dispatch, getState, { getHistory }) => { - const { user, updatePathname } = getHistory(); + const { updatePathname } = getHistory(); - if (newUser === user) { - // EDGE CASE: If the user that is being selected is equal to the user - // that is already selected, then updatePathname will not change - // anything. This results in state.search not properly being resetted. - // Example: If you search for 5H2 while already viewing 6-5H2, pressing - // enter won't do anything unless this check is present. - dispatch({ type: 'SEARCH/SET_USER', user }); - } else { - updatePathname(newUser || ''); - } + dispatch({ type: 'SEARCH/RESET' }); + updatePathname(newUser); }; } |