From 539a6bd740824766ff6c74c0eeb3d409dd37ab1c Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 21 Jan 2021 17:32:37 -0800 Subject: [PATCH] Oops, fix bug where suggestion didn't remove word --- src/app/WardrobePage/SearchToolbar.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/WardrobePage/SearchToolbar.js b/src/app/WardrobePage/SearchToolbar.js index d348049..bb86cad 100644 --- a/src/app/WardrobePage/SearchToolbar.js +++ b/src/app/WardrobePage/SearchToolbar.js @@ -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,