From 653926213bda56de620713e99a33a16b72d54730 Mon Sep 17 00:00:00 2001 From: adriancova Date: Tue, 20 Feb 2024 14:57:43 -0600 Subject: [PATCH 1/4] Remove TRANSACTION_DRAFT merge to null from successData and failureData --- src/libs/actions/IOU.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 47d10ddcef4b..3888e63bcd18 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1621,11 +1621,6 @@ function createSplitsAndOnyxData( key: `${ONYXKEYS.COLLECTION.TRANSACTION}${splitTransaction.transactionID}`, value: {pendingAction: null}, }, - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, - value: null, - }, ]; if (!existingSplitChatReport) { @@ -1644,11 +1639,6 @@ function createSplitsAndOnyxData( errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }, - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, - value: null, - }, ]; if (existingSplitChatReport) { From befeda98cf5370fedd31997a0c55a5c3e18e2b90 Mon Sep 17 00:00:00 2001 From: Adrian Covarrubias Date: Thu, 22 Feb 2024 09:20:01 -0600 Subject: [PATCH 2/4] adding back merge to null for failure data --- src/libs/actions/IOU.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 3888e63bcd18..0de6efcd1b07 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1639,6 +1639,11 @@ function createSplitsAndOnyxData( errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, + value: null, + }, ]; if (existingSplitChatReport) { From 7b43b0d0f0653058c67aa4ceec2c78036f413d79 Mon Sep 17 00:00:00 2001 From: Adrian Covarrubias Date: Thu, 22 Feb 2024 09:23:21 -0600 Subject: [PATCH 3/4] adding back merge to null for optimistic* data --- src/libs/actions/IOU.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 0de6efcd1b07..f95dc2569598 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1605,6 +1605,11 @@ function createSplitsAndOnyxData( key: `${ONYXKEYS.COLLECTION.TRANSACTION}${splitTransaction.transactionID}`, value: splitTransaction, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, + value: null, + }, ]; const successData: OnyxUpdate[] = [ @@ -1639,11 +1644,6 @@ function createSplitsAndOnyxData( errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }, - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, - value: null, - }, ]; if (existingSplitChatReport) { From 73e4b6cb36f03dee8c2ed27319cc9b5778edaa71 Mon Sep 17 00:00:00 2001 From: adriancova Date: Fri, 23 Feb 2024 09:27:49 -0600 Subject: [PATCH 4/4] removed transaction_draft set to null in failureData since its done in optimisticData --- src/libs/actions/IOU.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index f95dc2569598..42096fe9fb20 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -614,14 +614,6 @@ function buildOnyxDataForMoneyRequest( pendingFields: null, }, }, - - // Remove the temporary transaction used during the creation flow - { - onyxMethod: Onyx.METHOD.SET, - key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, - value: null, - }, - { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.reportID}`,