aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-07-03 19:28:12 +0200
committerNoah Loomans <noahloomans@gmail.com>2018-07-03 19:28:12 +0200
commitc1387d6e58669846c149c8b56500c05b1eb6a787 (patch)
tree2a9de9ead8ba90ad3a2eb86c1fa50f753b3dfde0
parent823aa5ad43126747cb071a0c347b200cc84df714 (diff)
Improve edge case comment
-rw-r--r--src/client/react/store/actions.js10
1 files 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 <Results /> 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 || '');