Skip to content

Commit

Permalink
use clean tag name to compare with values from autocompleteParser as …
Browse files Browse the repository at this point in the history
…they are also clean
  • Loading branch information
jaydamani committed Jan 17, 2025
1 parent dea4679 commit dd0de18
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/Search/SearchRouter/SearchRouterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {getCardDescription, isCard, isCardIssued, mergeCardListWithWorkspaceFeed
import {combineOrderingOfReportsAndPersonalDetails, getSearchOptions, getValidOptions} from '@libs/OptionsListUtils';
import type {Options, SearchOption} from '@libs/OptionsListUtils';
import Performance from '@libs/Performance';
import {getAllTaxRates, getCleanedTagName} from '@libs/PolicyUtils';
import {escapeTagName, getAllTaxRates, getCleanedTagName} from '@libs/PolicyUtils';
import type {OptionData} from '@libs/ReportUtils';
import {
getAutocompleteCategories,
Expand Down Expand Up @@ -229,14 +229,15 @@ function SearchRouterList(
case CONST.SEARCH.SYNTAX_FILTER_KEYS.TAG: {
const autocompleteList = autocompleteValue ? tagAutocompleteList : recentTagsAutocompleteList ?? [];
const filteredTags = autocompleteList
.map(getCleanedTagName)
.filter((tag) => tag.toLowerCase().includes(autocompleteValue.toLowerCase()) && !alreadyAutocompletedKeys.includes(tag.toLowerCase()))
.sort()
.slice(0, 10);

return filteredTags.map((tagName) => ({
filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.TAG,
text: getCleanedTagName(tagName),
autocompleteID: tagName,
text: tagName,
autocompleteID: escapeTagName(tagName),
mapKey: CONST.SEARCH.SYNTAX_FILTER_KEYS.TAG,
}));
}
Expand Down

0 comments on commit dd0de18

Please sign in to comment.