Search tweak (#123)

* fallback to selectSearchValue in the selectSearchQuery selector
This commit is contained in:
Akinwale Ariwodola 2019-03-27 08:01:15 +01:00 committed by GitHub
parent 0d4079f370
commit 1f211d183d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 /*: string*/) {
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: string) =>
page === 'search' ? params && params.query : searchValue
); );
export const selectIsSearching: (state: State) => boolean = createSelector( export const selectIsSearching: (state: State) => boolean = createSelector(