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 }) => {
const valueWithoutLastWord =
query.value.match(/^(.*?)\s*\S+$/)?.[1] || query.value;
const valueWithoutLastWord = query.value
? query.value.match(/^(.*?)\s*\S+$/)[1]
: query.value;
onChange({
...query,
value: valueWithoutLastWord,