From 04bdf1043c1870675229c4e4685befdfc40dcb0e Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 27 Mar 2019 07:56:58 +0100 Subject: [PATCH 1/3] fallback to selectSearchValue in the selectSearchQuery selector --- dist/bundle.js | 4 ++-- src/redux/selectors/search.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index 95d03e0..93bd36f 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -3409,8 +3409,8 @@ var selectSuggestions /*: ( return state.suggestions; }); -var selectSearchQuery /*: (state: State) => ?string*/ = exports.selectSearchQuery = (0, _reselect.createSelector)(_navigation.selectCurrentPage, _navigation.selectCurrentParams, function (page /*: string*/, params /*: ?{ query: string }*/) { - return page === 'search' ? params && params.query : null; +var selectSearchQuery /*: (state: State) => ?string*/ = exports.selectSearchQuery = (0, _reselect.createSelector)(_navigation.selectCurrentPage, _navigation.selectCurrentParams, selectSearchValue, function (page /*: string*/, params /*: ?{ query: string }*/, searchValue) { + return page === 'search' ? params && params.query : searchValue; }); var selectIsSearching /*: (state: State) => boolean*/ = exports.selectIsSearching = (0, _reselect.createSelector)(selectState, function (state) { diff --git a/src/redux/selectors/search.js b/src/redux/selectors/search.js index 5a0b322..424cb8d 100644 --- a/src/redux/selectors/search.js +++ b/src/redux/selectors/search.js @@ -30,7 +30,9 @@ export const selectSuggestions: ( export const selectSearchQuery: (state: State) => ?string = createSelector( selectCurrentPage, selectCurrentParams, - (page: string, params: ?{ query: string }) => (page === 'search' ? params && params.query : null) + selectSearchValue, + (page: string, params: ?{ query: string }, searchValue) => + page === 'search' ? params && params.query : searchValue ); export const selectIsSearching: (state: State) => boolean = createSelector( -- 2.45.2 From 049c432b8b1f53a82bc04095b1520e18d9764df6 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 27 Mar 2019 07:58:21 +0100 Subject: [PATCH 2/3] annotate parameter with type --- src/redux/selectors/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redux/selectors/search.js b/src/redux/selectors/search.js index 424cb8d..783aa59 100644 --- a/src/redux/selectors/search.js +++ b/src/redux/selectors/search.js @@ -31,7 +31,7 @@ export const selectSearchQuery: (state: State) => ?string = createSelector( selectCurrentPage, selectCurrentParams, selectSearchValue, - (page: string, params: ?{ query: string }, searchValue) => + (page: string, params: ?{ query: string }, searchValue: string) => page === 'search' ? params && params.query : searchValue ); -- 2.45.2 From 1e6c6a7ffd13a271f0a2c509dffbc18993fea886 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 27 Mar 2019 07:58:57 +0100 Subject: [PATCH 3/3] update bundle --- dist/bundle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/bundle.js b/dist/bundle.js index 93bd36f..297ffc4 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -3409,7 +3409,7 @@ var selectSuggestions /*: ( return state.suggestions; }); -var selectSearchQuery /*: (state: State) => ?string*/ = exports.selectSearchQuery = (0, _reselect.createSelector)(_navigation.selectCurrentPage, _navigation.selectCurrentParams, selectSearchValue, function (page /*: string*/, params /*: ?{ query: string }*/, searchValue) { +var selectSearchQuery /*: (state: State) => ?string*/ = exports.selectSearchQuery = (0, _reselect.createSelector)(_navigation.selectCurrentPage, _navigation.selectCurrentParams, selectSearchValue, function (page /*: string*/, params /*: ?{ query: string }*/, searchValue /*: string*/) { return page === 'search' ? params && params.query : searchValue; }); -- 2.45.2