Skip to content

Commit 0773398

Browse files
committed
fix: re-render
1 parent e106567 commit 0773398

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

src/components/Search/SearchAutocompleteList.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,6 @@ function SearchRouterItem(props: UserListItemProps<OptionData> | SearchQueryList
143143
);
144144
}
145145

146-
const ContinuationDetectionSearchFilterKey = [
147-
CONST.SEARCH.SYNTAX_FILTER_KEYS.TO,
148-
CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM,
149-
CONST.SEARCH.SYNTAX_FILTER_KEYS.ASSIGNEE,
150-
CONST.SEARCH.SYNTAX_FILTER_KEYS.PAYER,
151-
CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTER,
152-
] as SearchFilterKey[];
153-
154146
function SearchAutocompleteList(
155147
{
156148
autocompleteQueryValue,
@@ -269,7 +261,15 @@ function SearchAutocompleteList(
269261
if (!autocomplete && ranges.length > 0) {
270262
const lastRange = ranges.at(ranges.length - 1);
271263

272-
if (lastRange && ContinuationDetectionSearchFilterKey.includes(lastRange.key)) {
264+
const continuationDetectionSearchFilterKey = [
265+
CONST.SEARCH.SYNTAX_FILTER_KEYS.TO,
266+
CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM,
267+
CONST.SEARCH.SYNTAX_FILTER_KEYS.ASSIGNEE,
268+
CONST.SEARCH.SYNTAX_FILTER_KEYS.PAYER,
269+
CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTER,
270+
] as SearchFilterKey[];
271+
272+
if (lastRange && continuationDetectionSearchFilterKey.includes(lastRange.key)) {
273273
const afterLastRange = autocompleteQueryValue.substring(lastRange.start + lastRange.length);
274274
const continuationMatch = afterLastRange.match(/^\s+(\w+)/);
275275

@@ -677,7 +677,14 @@ function SearchAutocompleteList(
677677
}
678678

679679
const fieldKey = focusedItem.mapKey?.includes(':') ? focusedItem.mapKey.split(':').at(0) : focusedItem.mapKey;
680-
const isNameField = fieldKey && ContinuationDetectionSearchFilterKey.includes(fieldKey as SearchFilterKey);
680+
const continuationDetectionSearchFilterKey = [
681+
CONST.SEARCH.SYNTAX_FILTER_KEYS.TO,
682+
CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM,
683+
CONST.SEARCH.SYNTAX_FILTER_KEYS.ASSIGNEE,
684+
CONST.SEARCH.SYNTAX_FILTER_KEYS.PAYER,
685+
CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTER,
686+
] as SearchFilterKey[];
687+
const isNameField = fieldKey && continuationDetectionSearchFilterKey.includes(fieldKey as SearchFilterKey);
681688

682689
let trimmedUserSearchQuery;
683690
if (isNameField && fieldKey) {

0 commit comments

Comments
 (0)