Oops, fix bug where suggestion didn't remove word

This commit is contained in:
Emi Matchu 2021-01-21 17:32:37 -08:00
parent 2a08aa5ce9
commit 539a6bd740

View file

@ -192,8 +192,9 @@ function SearchToolbar({
} }
}} }}
onSuggestionSelected={(e, { suggestion }) => { onSuggestionSelected={(e, { suggestion }) => {
const valueWithoutLastWord = const valueWithoutLastWord = query.value
query.value.match(/^(.*?)\s*\S+$/)?.[1] || query.value; ? query.value.match(/^(.*?)\s*\S+$/)[1]
: query.value;
onChange({ onChange({
...query, ...query,
value: valueWithoutLastWord, value: valueWithoutLastWord,