Skip to content

Commit

Permalink
Merge pull request #47198 from Krishna2323/krishna2323/issue/47039
Browse files Browse the repository at this point in the history
fix: Report fields - List values field does not show the content in alphabetical order.
  • Loading branch information
mountiny authored Aug 12, 2024
2 parents 0341c3b + 8942b47 commit fd61159
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/pages/workspace/reportFields/CreateReportFieldsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ReportField from '@libs/actions/Policy/ReportField';
import DateUtils from '@libs/DateUtils';
import localeCompare from '@libs/LocaleCompare';
import Navigation from '@libs/Navigation/Navigation';
import * as PolicyUtils from '@libs/PolicyUtils';
import type {SettingsNavigatorParamList} from '@navigation/types';
Expand Down Expand Up @@ -151,7 +152,7 @@ function CreateReportFieldsPage({
description={translate('workspace.reportFields.listValues')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_REPORT_FIELDS_LIST_VALUES.getRoute(policyID))}
title={formDraft?.[INPUT_IDS.LIST_VALUES]?.join(', ')}
title={formDraft?.[INPUT_IDS.LIST_VALUES]?.sort(localeCompare)?.join(', ')}
numberOfLinesTitle={5}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import ScreenWrapper from '@components/ScreenWrapper';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import localeCompare from '@libs/LocaleCompare';
import Navigation from '@libs/Navigation/Navigation';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
Expand Down Expand Up @@ -47,7 +48,7 @@ function ReportFieldsSettingsPage({
const isDateFieldType = reportField.type === CONST.REPORT_FIELD_TYPES.DATE;
const isListFieldType = reportField.type === CONST.REPORT_FIELD_TYPES.LIST;
const isListFieldEmpty = isListFieldType && reportField.disabledOptions.filter((disabledListValue) => !disabledListValue).length <= 0;
const listValues = Object.values(policy?.fieldList?.[reportFieldKey]?.values ?? {});
const listValues = Object.values(policy?.fieldList?.[reportFieldKey]?.values ?? {})?.sort(localeCompare);

const deleteReportFieldAndHideModal = () => {
ReportField.deleteReportFields(policyID, [reportFieldKey]);
Expand Down

0 comments on commit fd61159

Please sign in to comment.