From 48abfaf602017e42aea312f3ed39810895923862 Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Wed, 26 Jun 2024 09:50:08 -0700 Subject: [PATCH 1/2] Show optimistic distance receipt for tracked expenses --- src/libs/actions/IOU.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 6a9427e884ec..0ffd0f53975d 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -3623,6 +3623,9 @@ function trackExpense( const moneyRequestReportID = isMoneyRequestReport ? report.reportID : ''; const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action); + // Pass an open receipt so the distance expense will show a map with the route optimistically + const trackedReceipt = validWaypoints ? {source: ReceiptGeneric as ReceiptSource, state: CONST.IOU.RECEIPT_STATE.OPEN} : receipt; + const { createdWorkspaceParams, iouReport, @@ -3645,7 +3648,7 @@ function trackExpense( currency, created, merchant, - receipt, + trackedReceipt, category, tag, taxCode, From bd7579304e4facb33b1c92af488d205ed49a01ab Mon Sep 17 00:00:00 2001 From: neil-marcellini Date: Tue, 2 Jul 2024 12:35:41 -0700 Subject: [PATCH 2/2] Consistently use trackedReceipt to handle optimistic case --- src/libs/actions/IOU.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 0ffd0f53975d..870ab3a174cf 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -3694,7 +3694,7 @@ function trackExpense( taxCode, taxAmount, billable, - receipt, + trackedReceipt, createdWorkspaceParams, ); break; @@ -3725,7 +3725,7 @@ function trackExpense( taxCode, taxAmount, billable, - receipt, + trackedReceipt, createdWorkspaceParams, ); break; @@ -3744,8 +3744,8 @@ function trackExpense( createdChatReportActionID: createdChatReportActionID ?? '-1', createdIOUReportActionID, reportPreviewReportActionID: reportPreviewAction?.reportActionID, - receipt, - receiptState: receipt?.state, + receipt: trackedReceipt, + receiptState: trackedReceipt?.state, category, tag, taxCode,