Don't remove word from query in Advanced Search

Oops, we were removing the last word of the search query if you picked a suggestion from Advanced Search! That behavior is meant for the case where you're _typing_ a filter name 😅
This commit is contained in:
Emi Matchu 2021-01-22 14:14:31 -08:00
parent a527d44e12
commit fca3ccf0a0

View file

@ -195,7 +195,11 @@ function SearchToolbar({
onSuggestionSelected={(e, { suggestion }) => { onSuggestionSelected={(e, { suggestion }) => {
onChange({ onChange({
...query, ...query,
value: removeLastWord(query.value), // If the suggestion was from typing, remove the last word of the
// query value. Or, if it was from Advanced Search, leave it alone!
value: advancedSearchIsOpen
? query.value
: removeLastWord(query.value),
filterToZoneLabel: suggestion.zoneLabel || query.filterToZoneLabel, filterToZoneLabel: suggestion.zoneLabel || query.filterToZoneLabel,
filterToItemKind: suggestion.itemKind || query.filterToItemKind, filterToItemKind: suggestion.itemKind || query.filterToItemKind,
filterToCurrentUserOwnsOrWants: filterToCurrentUserOwnsOrWants: