Skip to content

Commit

Permalink
Merge pull request #38958 from Expensify/aldo_fix-disabled-option-filter
Browse files Browse the repository at this point in the history
Fix filter based on reportField.disabledOptions
  • Loading branch information
amyevans authored Mar 25, 2024
2 parents e18dd5f + cd7d814 commit b6d2c59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/EditReportFieldDropdownPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function EditReportFieldDropdownPage({fieldName, onSubmit, fieldKey, fieldValue,
});
}

const filteredRecentlyUsedOptions = recentlyUsedOptions.filter((option) => option !== selectedValue);
const filteredRecentlyUsedOptions = recentlyUsedOptions.filter((option) => option !== selectedValue && fieldOptions.includes(option));
if (filteredRecentlyUsedOptions.length > 0) {
newSections.push({
title: translate('common.recents'),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EditReportFieldPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function EditReportFieldPage({route, policy, report}: EditReportFieldPageProps)
fieldKey={fieldKey}
fieldName={Str.UCFirst(reportField.name)}
fieldValue={fieldValue}
fieldOptions={reportField.values.filter((value) => !(value in reportField.disabledOptions))}
fieldOptions={reportField.values.filter((_value: string, index: number) => !reportField.disabledOptions[index])}
onSubmit={handleReportFieldChange}
/>
);
Expand Down

0 comments on commit b6d2c59

Please sign in to comment.