From cdb8683d126660a9d166ce6222f964eb8cb76b90 Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Sun, 27 Oct 2024 12:14:19 +0100 Subject: [PATCH 1/2] Fix report field initial value --- src/pages/workspace/reportFields/CreateReportFieldsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx b/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx index 8dbd90c9e929..5348edaffb9f 100644 --- a/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx +++ b/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx @@ -52,7 +52,7 @@ function CreateReportFieldsPage({ ReportField.createReportField(policyID, { name: values[INPUT_IDS.NAME], type: values[INPUT_IDS.TYPE], - initialValue: values[INPUT_IDS.INITIAL_VALUE], + initialValue: !(values[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.LIST && availableListValuesLength === 0) ? values[INPUT_IDS.INITIAL_VALUE] : '', }); Navigation.goBack(); }, From 241e066ffb915bb7b1d96ba8aeabe2de45ec4d87 Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Sun, 27 Oct 2024 12:25:30 +0100 Subject: [PATCH 2/2] fixing eslint --- src/pages/workspace/reportFields/CreateReportFieldsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx b/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx index 5348edaffb9f..461c5122c5d4 100644 --- a/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx +++ b/src/pages/workspace/reportFields/CreateReportFieldsPage.tsx @@ -56,7 +56,7 @@ function CreateReportFieldsPage({ }); Navigation.goBack(); }, - [policyID], + [availableListValuesLength, policyID], ); const validateForm = useCallback(