aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/reducers
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-12-21 13:10:05 +0100
committerNoah Loomans <noahloomans@gmail.com>2017-12-21 13:10:05 +0100
commit4ca30295d7d9f3dd7ba2e105952ff627f6b702a4 (patch)
tree48285ecb1957171ebb9b0106aaf2d1a184972d0e /src/client/react/reducers
parentf0c8cf0e79f003514fd65a70def5820205955a77 (diff)
Add strict typing
Except for functions because of https://github.com/reactjs/redux/issues/2709
Diffstat (limited to 'src/client/react/reducers')
-rw-r--r--src/client/react/reducers/search.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/client/react/reducers/search.ts b/src/client/react/reducers/search.ts
index 658d3ca..470e650 100644
--- a/src/client/react/reducers/search.ts
+++ b/src/client/react/reducers/search.ts
@@ -61,7 +61,7 @@ const search = (state = DEFAULT_STATE, action: Action): State => {
if (isExactMatch) return state;
const prevSelectedResult = state.selectedResult;
- const prevSelectedResultIndex = results.indexOf(prevSelectedResult);
+ const prevSelectedResultIndex = prevSelectedResult ? results.indexOf(prevSelectedResult) : -1;
let nextSelectedResultIndex =
prevSelectedResultIndex + action.relativeChange;