From bdcf84d0da56697df4063a8ab5951cc14a86bbbb Mon Sep 17 00:00:00 2001 From: daledah Date: Tue, 18 Nov 2025 21:41:11 +0800 Subject: [PATCH 1/3] fix: App crash when trying to open a WS connected to NetSuite --- src/libs/actions/Policy/Member.ts | 8 ++++---- src/pages/workspace/WorkspaceOverviewPage.tsx | 2 +- src/pages/workspace/WorkspacesListPage.tsx | 2 +- .../members/WorkspaceMemberDetailsPage.tsx | 2 +- src/types/onyx/Policy.ts | 16 ++++++++-------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libs/actions/Policy/Member.ts b/src/libs/actions/Policy/Member.ts index 6d57cef2ac97..12772ec00ec3 100644 --- a/src/libs/actions/Policy/Member.ts +++ b/src/libs/actions/Policy/Member.ts @@ -323,7 +323,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[]) } for (const connection of connections) { - const exporter = policy?.connections?.[connection]?.config.export.exporter; + const exporter = policy?.connections?.[connection]?.config?.export?.exporter; if (!exporter || !adminLoginList.includes(exporter)) { continue; } @@ -357,7 +357,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[]) connections: { [connection]: { config: { - export: {exporter: policy?.connections?.[connection]?.config.export.exporter}, + export: {exporter: policy?.connections?.[connection]?.config?.export?.exporter}, pendingFields: {[pendingFieldKey]: null}, }, }, @@ -366,7 +366,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[]) }); } - const exporter = policy?.connections?.netsuite?.options.config.exporter; + const exporter = policy?.connections?.netsuite?.options?.config?.exporter; if (exporter && adminLoginList.includes(exporter)) { optimisticData.push({ onyxMethod: Onyx.METHOD.MERGE, @@ -385,7 +385,7 @@ function resetAccountingPreferredExporter(policyID: string, loginList: string[]) failureData.push({ onyxMethod: Onyx.METHOD.MERGE, key: policyKey, - value: {connections: {netsuite: {options: {config: {exporter: policy?.connections?.netsuite?.options.config.exporter, pendingFields: {exporter: null}}}}}}, + value: {connections: {netsuite: {options: {config: {exporter: policy?.connections?.netsuite?.options?.config?.exporter, pendingFields: {exporter: null}}}}}}, }); } diff --git a/src/pages/workspace/WorkspaceOverviewPage.tsx b/src/pages/workspace/WorkspaceOverviewPage.tsx index 55fc36fa9e36..cddfb1823833 100644 --- a/src/pages/workspace/WorkspaceOverviewPage.tsx +++ b/src/pages/workspace/WorkspaceOverviewPage.tsx @@ -339,7 +339,7 @@ function WorkspaceOverviewPage({policyDraft, policy: policyProp, route}: Workspa policy?.connections?.quickbooksDesktop?.config?.export?.exporter, policy?.connections?.quickbooksOnline?.config?.export?.exporter, policy?.connections?.xero?.config?.export?.exporter, - policy?.connections?.netsuite?.options.config.exporter, + policy?.connections?.netsuite?.options?.config?.exporter, ]; const policyOwnerDisplayName = personalDetails?.[policy?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID]?.displayName ?? ''; const technicalContact = policy?.technicalContact; diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index a7eebb71d8d2..43b7f815fde3 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -245,7 +245,7 @@ function WorkspacesListPage() { policyToLeave?.connections?.quickbooksDesktop?.config?.export?.exporter, policyToLeave?.connections?.quickbooksOnline?.config?.export?.exporter, policyToLeave?.connections?.xero?.config?.export?.exporter, - policyToLeave?.connections?.netsuite?.options.config.exporter, + policyToLeave?.connections?.netsuite?.options?.config?.exporter, ]; const policyOwnerDisplayName = personalDetails?.[policyToLeave?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID]?.displayName ?? ''; const technicalContact = policyToLeave?.technicalContact; diff --git a/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx b/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx index 70e207460f12..62efe5fb2d72 100644 --- a/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx +++ b/src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx @@ -136,7 +136,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM policy?.connections?.quickbooksDesktop?.config?.export?.exporter, policy?.connections?.quickbooksOnline?.config?.export?.exporter, policy?.connections?.xero?.config?.export?.exporter, - policy?.connections?.netsuite?.options.config.exporter, + policy?.connections?.netsuite?.options?.config?.exporter, ]; const isUserExporter = exporters.includes(details.login); diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 36d655cf70eb..fcb71a8f151f 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -538,9 +538,9 @@ type QBOConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback<{ exportDate: ValueOf; /** Configuration of the export */ - export: { + export?: { /** E-mail of the exporter */ - exporter: string; + exporter?: string; }; /** Collections of form field errors */ @@ -670,7 +670,7 @@ type XeroExportConfig = { billable: ExpenseTypesValues; /** The e-mail of the exporter */ - exporter: string; + exporter?: string; /** TODO: Will be handled in another issue */ nonReimbursable: ExpenseTypesValues; @@ -1041,7 +1041,7 @@ type NetSuiteConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback< autoCreateEntities: boolean; /** The account to run auto export */ - exporter: string; + exporter?: string; /** The transaction date to set upon export */ exportDate?: NetSuiteExportDateOptions; @@ -1251,7 +1251,7 @@ type SageIntacctExportConfig = { exportDate: ValueOf; /** The e-mail of the exporter */ - exporter: string; + exporter?: string; /** Defines how non-reimbursable expenses are exported */ nonReimbursable: ValueOf; @@ -1310,7 +1310,7 @@ type SageIntacctConnectionsConfig = OnyxCommon.OnyxValueWithOfflineFeedback< }; /** Sage Intacct export configs */ - export: SageIntacctExportConfig; + export?: SageIntacctExportConfig; /** Whether employees should be imported from Sage Intacct */ importEmployees: boolean; @@ -1364,7 +1364,7 @@ type QBDConnectionData = { */ type QBDExportConfig = { /** E-mail of the exporter */ - exporter: string; + exporter?: string; /** Defines how reimbursable expenses are exported */ reimbursable: QBDReimbursableExportAccountType; @@ -1415,7 +1415,7 @@ type QBDConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback< importItems: boolean; /** Configuration of the export */ - export: QBDExportConfig; + export?: QBDExportConfig; /** Configuration of import settings from QuickBooks Desktop to the app */ mappings: { From f3c2d1f32d5fbcc39aa7390b1248cf0a1a6c00d3 Mon Sep 17 00:00:00 2001 From: daledah Date: Thu, 20 Nov 2025 00:52:18 +0700 Subject: [PATCH 2/3] fix ts error --- src/types/onyx/Policy.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index fcb71a8f151f..8abd836c2147 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -538,7 +538,7 @@ type QBOConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback<{ exportDate: ValueOf; /** Configuration of the export */ - export?: { + export: { /** E-mail of the exporter */ exporter?: string; }; @@ -1310,7 +1310,7 @@ type SageIntacctConnectionsConfig = OnyxCommon.OnyxValueWithOfflineFeedback< }; /** Sage Intacct export configs */ - export?: SageIntacctExportConfig; + export: SageIntacctExportConfig; /** Whether employees should be imported from Sage Intacct */ importEmployees: boolean; @@ -1415,7 +1415,7 @@ type QBDConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback< importItems: boolean; /** Configuration of the export */ - export?: QBDExportConfig; + export: QBDExportConfig; /** Configuration of import settings from QuickBooks Desktop to the app */ mappings: { From 512ce42c79e57a55c8c4320bcf9935dee154f5a9 Mon Sep 17 00:00:00 2001 From: daledah Date: Thu, 20 Nov 2025 01:09:38 +0700 Subject: [PATCH 3/3] fix ts --- src/libs/actions/connections/QuickbooksDesktop.ts | 2 +- src/libs/actions/connections/QuickbooksOnline.ts | 2 +- src/libs/actions/connections/Xero.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/connections/QuickbooksDesktop.ts b/src/libs/actions/connections/QuickbooksDesktop.ts index f0c0a94e59b7..c6f50ddd8533 100644 --- a/src/libs/actions/connections/QuickbooksDesktop.ts +++ b/src/libs/actions/connections/QuickbooksDesktop.ts @@ -479,7 +479,7 @@ function updateQuickbooksDesktopPreferredExporter