From dd2056dfca46ca677a95b35cbe3c537109b381e0 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 11 Nov 2024 13:30:19 +0100 Subject: [PATCH 1/2] fix bug with default exporter --- .../accounting/qbd/export/QuickbooksDesktopExportPage.tsx | 3 ++- .../QuickbooksDesktopPreferredExporterConfigurationPage.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx index 8555be0d3d83..d6fc05526c1d 100644 --- a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx +++ b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx @@ -31,7 +31,8 @@ function QuickbooksDesktopExportPage({policy}: WithPolicyConnectionsProps) { { description: translate('workspace.accounting.preferredExporter'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_DESKTOP_PREFERRED_EXPORTER.getRoute(policyID)), - title: qbdConfig?.export?.exporter ?? policyOwner, + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + title: qbdConfig?.export?.exporter || policyOwner, subscribedSettings: [CONST.QUICKBOOKS_DESKTOP_CONFIG.EXPORTER], }, { diff --git a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopPreferredExporterConfigurationPage.tsx index eef48ee04dcf..2a227d7df344 100644 --- a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopPreferredExporterConfigurationPage.tsx @@ -45,7 +45,8 @@ function QuickbooksDesktopPreferredExporterConfigurationPage({policy}: WithPolic value: exporter.email, text: exporter.email, keyForList: exporter.email, - isSelected: (currentExporter ?? policy?.owner) === exporter.email, + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + isSelected: (currentExporter || policy?.owner) === exporter.email, }); return options; }, []), From 479d3687dadad6ac96753a4c638b343f7d387d5c Mon Sep 17 00:00:00 2001 From: Yauheni Date: Tue, 12 Nov 2024 08:22:25 +0100 Subject: [PATCH 2/2] add comments for new changes --- .../accounting/qbd/export/QuickbooksDesktopExportPage.tsx | 1 + .../QuickbooksDesktopPreferredExporterConfigurationPage.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx index d6fc05526c1d..ff8547952155 100644 --- a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx +++ b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx @@ -31,6 +31,7 @@ function QuickbooksDesktopExportPage({policy}: WithPolicyConnectionsProps) { { description: translate('workspace.accounting.preferredExporter'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_DESKTOP_PREFERRED_EXPORTER.getRoute(policyID)), + // We use the logical OR (||) here instead of ?? because `exporter` could be an empty string // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing title: qbdConfig?.export?.exporter || policyOwner, subscribedSettings: [CONST.QUICKBOOKS_DESKTOP_CONFIG.EXPORTER], diff --git a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopPreferredExporterConfigurationPage.tsx index 2a227d7df344..b571f67e8350 100644 --- a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopPreferredExporterConfigurationPage.tsx @@ -45,6 +45,7 @@ function QuickbooksDesktopPreferredExporterConfigurationPage({policy}: WithPolic value: exporter.email, text: exporter.email, keyForList: exporter.email, + // We use the logical OR (||) here instead of ?? because `exporter` could be an empty string // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing isSelected: (currentExporter || policy?.owner) === exporter.email, });