From c1387d6e58669846c149c8b56500c05b1eb6a787 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Tue, 3 Jul 2018 19:28:12 +0200 Subject: Improve edge case comment --- src/client/react/store/actions.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/react/store/actions.js b/src/client/react/store/actions.js index e6aa8f6..b123a8b 100644 --- a/src/client/react/store/actions.js +++ b/src/client/react/store/actions.js @@ -6,11 +6,11 @@ export function setUser(newUser) { const { user, updatePathname } = getHistory(); if (newUser === user) { - // EDGE CASE: The user is set if the user changes, but it doesn't - // change if the result is already the one we are viewing. - // Causing the object to not collapse when a user is - // selected. - // Therefor, we need to dispatch the SET_USER command manually. + // 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 || ''); -- cgit v1.1