diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index de896e6f72f5..fb81cde68f77 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -633,18 +633,6 @@ function buildOnyxDataForMoneyRequest( }); } - if (!isOneOnOneSplit) { - optimisticData.push({ - onyxMethod: Onyx.METHOD.SET, - key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, - value: { - action: newQuickAction, - chatReportID: chatReport?.reportID, - isFirstQuickAction: isEmptyObject(quickAction), - }, - }); - } - if (optimisticPolicyRecentlyUsedCategories.length) { optimisticData.push({ onyxMethod: Onyx.METHOD.SET, @@ -875,6 +863,23 @@ function buildOnyxDataForMoneyRequest( }, ]; + if (!isOneOnOneSplit) { + optimisticData.push({ + onyxMethod: Onyx.METHOD.SET, + key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, + value: { + action: newQuickAction, + chatReportID: chatReport?.reportID, + isFirstQuickAction: isEmptyObject(quickAction), + }, + }); + failureData.push({ + onyxMethod: Onyx.METHOD.SET, + key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, + value: quickAction ?? null, + }); + } + if (!isEmptyObject(transactionThreadCreatedReportAction)) { failureData.push({ onyxMethod: Onyx.METHOD.MERGE, @@ -4103,6 +4108,11 @@ function createSplitsAndOnyxData( pendingFields: null, }, }, + { + onyxMethod: Onyx.METHOD.SET, + key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, + value: quickAction ?? null, + }, ]; if (existingSplitChatReport) { @@ -4673,6 +4683,11 @@ function startSplitBill({ errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericCreateFailureMessage'), }, }, + { + onyxMethod: Onyx.METHOD.SET, + key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, + value: quickAction ?? null, + }, ]; if (existingSplitChatReport) { @@ -6353,6 +6368,11 @@ function getSendMoneyParams( }, }, }, + { + onyxMethod: Onyx.METHOD.SET, + key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, + value: quickAction ?? null, + }, ]; // Now, let's add the data we need just when we are creating a new chat report diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts index bb96c98100a2..b35a2a413429 100644 --- a/src/libs/actions/Task.ts +++ b/src/libs/actions/Task.ts @@ -243,6 +243,11 @@ function createTaskAndNavigate( targetAccountID: assigneeAccountID, }, }); + failureData.push({ + onyxMethod: Onyx.METHOD.SET, + key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, + value: quickAction ?? null, + }); // If needed, update optimistic data for parent report action of the parent report. const optimisticParentReportData = ReportUtils.getOptimisticDataForParentReportAction(parentReportID, currentTime, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);