From dd5131454fa4a33138b6a46c542ab0259d08c137 Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Mon, 6 May 2024 00:03:41 +0530 Subject: [PATCH 1/2] fix: xero disconnection --- src/libs/actions/connections/index.ts | 14 ++------------ .../workspace/accounting/PolicyAccountingPage.tsx | 4 +++- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index 5ce806c7d4be..6d4ab183a82b 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -25,22 +25,12 @@ function removePolicyConnection(policyID: string, connectionName: PolicyConnecti value: null, }, ]; - const failureData: OnyxUpdate[] = [ - // { - // onyxMethod: Onyx.METHOD.MERGE, - // key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, - // value: { - // errorFields: { - // avatar: ErrorUtils.getMicroSecondOnyxError('avatarWithImagePicker.deleteWorkspaceError'), - // }, - // }, - // }, - ]; + const parameters: RemovePolicyConnectionParams = { policyID, connectionName, }; - API.write(WRITE_COMMANDS.REMOVE_POLICY_CONNECTION, parameters, {optimisticData, failureData}); + API.write(WRITE_COMMANDS.REMOVE_POLICY_CONNECTION, parameters, {optimisticData}); } function updatePolicyConnectionConfig( policyID: string, diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index 87bede34f3cb..17b8eb895dba 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -355,7 +355,9 @@ function PolicyAccountingPage({policy, connectionSyncProgress}: PolicyAccounting title={translate('workspace.accounting.disconnectTitle', connectedIntegration)} isVisible={isDisconnectModalOpen} onConfirm={() => { - removePolicyConnection(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO); + if (connectedIntegration) { + removePolicyConnection(policyID, connectedIntegration); + } setIsDisconnectModalOpen(false); }} onCancel={() => setIsDisconnectModalOpen(false)} From 25c5cb4204db9cf15245c03e97e708f3687d2cea Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Mon, 6 May 2024 09:21:39 +0530 Subject: [PATCH 2/2] style: prettier fix --- src/libs/actions/connections/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index 6d4ab183a82b..f9d16692aedd 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -25,7 +25,7 @@ function removePolicyConnection(policyID: string, connectionName: PolicyConnecti value: null, }, ]; - + const parameters: RemovePolicyConnectionParams = { policyID, connectionName,