From fca3ccf0a02f331a3e9eaca37484e1f4e6b837cb Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 22 Jan 2021 14:14:31 -0800 Subject: [PATCH] Don't remove word from query in Advanced Search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 😅 --- src/app/WardrobePage/SearchToolbar.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/WardrobePage/SearchToolbar.js b/src/app/WardrobePage/SearchToolbar.js index ac0fc17..456dce0 100644 --- a/src/app/WardrobePage/SearchToolbar.js +++ b/src/app/WardrobePage/SearchToolbar.js @@ -195,7 +195,11 @@ function SearchToolbar({ onSuggestionSelected={(e, { suggestion }) => { onChange({ ...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, filterToItemKind: suggestion.itemKind || query.filterToItemKind, filterToCurrentUserOwnsOrWants: