From f578152267787e7d55530a0101370cf1ae9b927f Mon Sep 17 00:00:00 2001 From: Dysto coder Date: Sat, 11 Jan 2025 14:37:48 +0300 Subject: [PATCH 1/3] escape calling Report_setFields when selecting the same report field --- src/pages/EditReportFieldPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/EditReportFieldPage.tsx b/src/pages/EditReportFieldPage.tsx index 1a082310ff53..a656b994fb25 100644 --- a/src/pages/EditReportFieldPage.tsx +++ b/src/pages/EditReportFieldPage.tsx @@ -68,7 +68,9 @@ function EditReportFieldPage({route}: EditReportFieldPageProps) { ReportActions.updateReportName(report.reportID, value, report.reportName ?? ''); goBack(); } else { - ReportActions.updateReportField(report.reportID, {...reportField, value: value === '' ? null : value}, reportField); + if (value !== '') { + ReportActions.updateReportField(report.reportID, {...reportField, value}, reportField); + } Navigation.dismissModal(isSearchTopmostCentralPane() ? undefined : report?.reportID); } }; From 7df8a6eabf4c3f09bdde36b978bfffedc0b7fa1e Mon Sep 17 00:00:00 2001 From: Dysto coder Date: Sat, 11 Jan 2025 15:27:54 +0300 Subject: [PATCH 2/3] remove unused policyID from EditReportFieldDropdownPage --- src/pages/EditReportFieldDropdown.tsx | 4 ---- src/pages/EditReportFieldPage.tsx | 1 - 2 files changed, 5 deletions(-) diff --git a/src/pages/EditReportFieldDropdown.tsx b/src/pages/EditReportFieldDropdown.tsx index e8364d7d1f37..f6b8a4576344 100644 --- a/src/pages/EditReportFieldDropdown.tsx +++ b/src/pages/EditReportFieldDropdown.tsx @@ -20,10 +20,6 @@ type EditReportFieldDropdownPageComponentProps = { /** Key of the policy report field */ fieldKey: string; - /** ID of the policy this report field belongs to */ - // eslint-disable-next-line react/no-unused-prop-types - policyID: string; - /** Options of the policy report field */ fieldOptions: string[]; diff --git a/src/pages/EditReportFieldPage.tsx b/src/pages/EditReportFieldPage.tsx index a656b994fb25..e429cc8681be 100644 --- a/src/pages/EditReportFieldPage.tsx +++ b/src/pages/EditReportFieldPage.tsx @@ -141,7 +141,6 @@ function EditReportFieldPage({route}: EditReportFieldPageProps) { {reportField.type === 'dropdown' && ( !policyField.disabledOptions.at(index))} From fc0a4d4fe1e905c04655664c1577845b8edfacdf Mon Sep 17 00:00:00 2001 From: Dysto coder Date: Sat, 11 Jan 2025 15:33:58 +0300 Subject: [PATCH 3/3] remove unnecessary EditReportFieldDropdownPageProps type --- src/pages/EditReportFieldDropdown.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/EditReportFieldDropdown.tsx b/src/pages/EditReportFieldDropdown.tsx index f6b8a4576344..4d01240f54f3 100644 --- a/src/pages/EditReportFieldDropdown.tsx +++ b/src/pages/EditReportFieldDropdown.tsx @@ -27,9 +27,7 @@ type EditReportFieldDropdownPageComponentProps = { onSubmit: (form: Record) => void; }; -type EditReportFieldDropdownPageProps = EditReportFieldDropdownPageComponentProps; - -function EditReportFieldDropdownPage({onSubmit, fieldKey, fieldValue, fieldOptions}: EditReportFieldDropdownPageProps) { +function EditReportFieldDropdownPage({onSubmit, fieldKey, fieldValue, fieldOptions}: EditReportFieldDropdownPageComponentProps) { const [recentlyUsedReportFields] = useOnyx(ONYXKEYS.RECENTLY_USED_REPORT_FIELDS); const [searchValue, debouncedSearchValue, setSearchValue] = useDebouncedState(''); const theme = useTheme();