diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 4690e2ca284d1..3891d03d64195 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -6314,6 +6314,14 @@ function getReportFromHoldRequestsOnyxData( [optimisticExpenseReportPreview.reportActionID]: optimisticExpenseReportPreview, }, }, + // update total of the old iou report + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, + value: { + total: iouReport?.total !== undefined ? iouReport.total - (firstHoldTransaction?.amount ?? 0) : 0, + }, + }, // remove hold report actions from old iou report { onyxMethod: Onyx.METHOD.MERGE, @@ -6365,6 +6373,14 @@ function getReportFromHoldRequestsOnyxData( [optimisticExpenseReportPreview.reportActionID]: null, }, }, + // reset total of the old iou report + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, + value: { + total: iouReport?.total, + }, + }, // add hold report actions back to old iou report { onyxMethod: Onyx.METHOD.MERGE,