Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6496,6 +6496,7 @@ const CONST = {
get SEARCH_USER_FRIENDLY_VALUES_MAP() {
return {
[this.TRANSACTION_TYPE.PER_DIEM]: 'per-diem',
[this.GROUP_BY.REPORTS]: 'report',
};
},
DATE_MODIFIERS: {
Expand Down
5 changes: 2 additions & 3 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function SearchAutocompleteList(
const [isInitialRender, setIsInitialRender] = useState(true);

const typeAutocompleteList = Object.values(CONST.SEARCH.DATA_TYPES);
const groupByAutocompleteList = Object.values(CONST.SEARCH.GROUP_BY);
const groupByAutocompleteList = Object.values(CONST.SEARCH.GROUP_BY).map((value) => getUserFriendlyValue(value));

const statusAutocompleteList = useMemo(() => {
const parsedQuery = parseForAutocomplete(autocompleteQueryValue);
Expand All @@ -212,7 +212,7 @@ function SearchAutocompleteList(
}
}, [autocompleteQueryValue]);

const expenseTypes = Object.values(CONST.SEARCH.TRANSACTION_TYPE);
const expenseTypes = Object.values(CONST.SEARCH.TRANSACTION_TYPE).map((value) => getUserFriendlyValue(value));
const withdrawalTypes = Object.values(CONST.SEARCH.WITHDRAWAL_TYPE);
const booleanTypes = Object.values(CONST.SEARCH.BOOLEAN);

Expand Down Expand Up @@ -390,7 +390,6 @@ function SearchAutocompleteList(
}
case CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPENSE_TYPE: {
const filteredExpenseTypes = expenseTypes
.map((value) => getUserFriendlyValue(value))
.filter((expenseType) => expenseType.includes(autocompleteValue.toLowerCase()) && !alreadyAutocompletedKeys.includes(expenseType))
.sort();

Expand Down
3 changes: 2 additions & 1 deletion src/libs/SearchAutocompleteUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function getAutocompleteQueryWithComma(prevQuery: string, newQuery: string) {
}

const userFriendlyExpenseTypeList = Object.values(CONST.SEARCH.TRANSACTION_TYPE).map((value) => getUserFriendlyValue(value));
const userFriendlyGroupByList = Object.values(CONST.SEARCH.GROUP_BY).map((value) => getUserFriendlyValue(value));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to do this because getUserFriendlyValue is not a worklet function, so it'd result in an error if we called it within filterOutRangesWithCorrectValue below


/**
* @private
Expand All @@ -135,7 +136,7 @@ function filterOutRangesWithCorrectValue(
...CONST.SEARCH.STATUS.TRIP,
...CONST.SEARCH.STATUS.TASK,
}) as string[];
const groupByList = Object.values(CONST.SEARCH.GROUP_BY) as string[];
const groupByList = userFriendlyGroupByList;
const booleanList = Object.values(CONST.SEARCH.BOOLEAN) as string[];
const actionList = Object.values(CONST.SEARCH.ACTION_FILTERS) as string[];
const datePresetList = Object.values(CONST.SEARCH.DATE_PRESETS) as string[];
Expand Down
Loading
Loading