Skip to content

Commit

Permalink
Merge pull request #44489 from Expensify/neil-optimistic-track-route
Browse files Browse the repository at this point in the history
Show optimistic distance receipt for tracked expenses
  • Loading branch information
chiragsalian authored Jul 2, 2024
2 parents 7264dec + bd75793 commit a095d52
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3627,6 +3627,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,
Expand All @@ -3649,7 +3652,7 @@ function trackExpense(
currency,
created,
merchant,
receipt,
trackedReceipt,
category,
tag,
taxCode,
Expand Down Expand Up @@ -3695,7 +3698,7 @@ function trackExpense(
taxCode,
taxAmount,
billable,
receipt,
trackedReceipt,
createdWorkspaceParams,
);
break;
Expand Down Expand Up @@ -3726,7 +3729,7 @@ function trackExpense(
taxCode,
taxAmount,
billable,
receipt,
trackedReceipt,
createdWorkspaceParams,
);
break;
Expand All @@ -3745,8 +3748,8 @@ function trackExpense(
createdChatReportActionID: createdChatReportActionID ?? '-1',
createdIOUReportActionID,
reportPreviewReportActionID: reportPreviewAction?.reportActionID,
receipt,
receiptState: receipt?.state,
receipt: trackedReceipt,
receiptState: trackedReceipt?.state,
category,
tag,
taxCode,
Expand Down

0 comments on commit a095d52

Please sign in to comment.