fallback to selectSearchValue in the selectSearchQuery selector

This commit is contained in:
Akinwale Ariwodola 2019-03-27 07:56:58 +01:00
parent 0d4079f370
commit 04bdf1043c
2 changed files with 5 additions and 3 deletions

4
dist/bundle.js vendored
View file

@ -3409,8 +3409,8 @@ var selectSuggestions /*: (
return state.suggestions; return state.suggestions;
}); });
var selectSearchQuery /*: (state: State) => ?string*/ = exports.selectSearchQuery = (0, _reselect.createSelector)(_navigation.selectCurrentPage, _navigation.selectCurrentParams, function (page /*: string*/, params /*: ?{ query: string }*/) { 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 : null; return page === 'search' ? params && params.query : searchValue;
}); });
var selectIsSearching /*: (state: State) => boolean*/ = exports.selectIsSearching = (0, _reselect.createSelector)(selectState, function (state) { var selectIsSearching /*: (state: State) => boolean*/ = exports.selectIsSearching = (0, _reselect.createSelector)(selectState, function (state) {

View file

@ -30,7 +30,9 @@ export const selectSuggestions: (
export const selectSearchQuery: (state: State) => ?string = createSelector( export const selectSearchQuery: (state: State) => ?string = createSelector(
selectCurrentPage, selectCurrentPage,
selectCurrentParams, 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( export const selectIsSearching: (state: State) => boolean = createSelector(