You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expense - Merchant & Amount show "Scanning" when distance is submitted from self DM offline #82960
Please re-state the problem that we are trying to solve in this issue.
Expense - Merchant & Amount show "Scanning" when distance is submitted from self DM offline
What is the root cause of that problem?
When we create the distance request on map in offline mode, the distanceInMeters is 0 and since we are creating distance-map request(on map) and not a manual distance request. So the function getDistanceMerchant returns empty string here as both the conditions (!distanceInMeters && !isManualDistanceRequest) are satisfied here:
Which makes the condition for isPartialTransaction as true above.
Which makes the isScanning function to return true as both isPartialTransaction(transaction) && hasReceipt(transaction) true because we already attach dummy receipt for distance requests while creating.
What changes do you think we should make in order to solve the problem?
We already have the value of transaction.merchant as pending, so we need to use transaction.merchant as a fallback when we are having distance request and when getMerchant function returns emtpy string. For that we can make the following changes here:
And for total cell add the condition to check for distance request, and only show scanning if it is not a distance request here:
index 5c5248cff74..fa84c0d2447 100644
--- a/src/components/TransactionItemRow/DataCells/TotalCell.tsx+++ b/src/components/TransactionItemRow/DataCells/TotalCell.tsx@@ -4,7 +4,7 @@ import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {convertToDisplayString} from '@libs/CurrencyUtils';
import {getTransactionDetails} from '@libs/ReportUtils';
-import {getCurrency as getTransactionCurrency, isScanning} from '@libs/TransactionUtils';+import {getCurrency as getTransactionCurrency, isDistanceRequest, isScanning} from '@libs/TransactionUtils';
import type TransactionDataCellProps from './TransactionDataCellProps';
function TotalCell({shouldShowTooltip, transactionItem}: TransactionDataCellProps) {
@@ -14,7 +14,7 @@ function TotalCell({shouldShowTooltip, transactionItem}: TransactionDataCellProp
const amount = getTransactionDetails(transactionItem)?.amount;
let amountToDisplay = convertToDisplayString(amount, currency);
- if (isScanning(transactionItem)) {+ if (isScanning(transactionItem) && !isDistanceRequest(transactionItem)) {
amountToDisplay = translate('iou.receiptStatusTitle');
}
What alternative solutions did you explore? (Optional)
Alternate solution 1:
We can also change the condition inside the isScanning function to check for distance requests, return false always if it is a distance request as distance requests are never scanned. For that we can make the following changes here:
functionisScanning(transaction: OnyxEntry<Transaction>): boolean{// Performance optimization: Check the receipt state first (cheapest check) before doing more expensive checksif(!isReceiptBeingScanned(transaction)){returnfalse;}return!isDistanceRequest(transaction)&&isPartialTransaction(transaction)&&hasReceipt(transaction);}
And here, we still need to fallback to transactionItem.merchant for distance request when getMerchant return '', so we need to make the following changes here:
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
This issue has not been updated in over 15 days. eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
Burhan-Rashid commentedon Feb 22, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Merchant & Amount show "Scanning" when distance is submitted from self DM offline
What is the root cause of that problem?
When we create the distance request on map in offline mode, the
distanceInMetersis 0 and since we are creatingdistance-maprequest(on map) and not a manual distance request. So the functiongetDistanceMerchantreturns empty string here as both the conditions(!distanceInMeters && !isManualDistanceRequest)are satisfied here:App/src/libs/DistanceRequestUtils.ts
Lines 217 to 235 in 5fc6b58
getDistanceMerchantis called here insidegetMerchantfunction:App/src/libs/TransactionUtils/index.ts
Lines 1097 to 1122 in 5fc6b58
Which is inturn called in here for checking isPartialTransaction:
App/src/libs/TransactionUtils/index.ts
Lines 392 to 398 in 5fc6b58
Which makes the condition for isPartialTransaction as true above.
Which makes the
isScanningfunction to return true as bothisPartialTransaction(transaction) && hasReceipt(transaction)true because we already attach dummy receipt for distance requests while creating.App/src/libs/TransactionUtils/index.ts
Lines 1406 to 1414 in 5fc6b58
Since we get true for
isScanningfunction, outtotalcell renders 'scanning' here:App/src/components/TransactionItemRow/DataCells/TotalCell.tsx
Lines 17 to 20 in 5fc6b58
For merchant cell, we get the value of merchant from here, where also the same conditions make us set merchant to scanning instead of pending.
App/src/components/TransactionItemRow/index.tsx
Lines 147 to 150 in 5fc6b58
What changes do you think we should make in order to solve the problem?
We already have the value of
transaction.merchantaspending, so we need to usetransaction.merchantas a fallback when we are having distance request and whengetMerchantfunction returnsemtpystring. For that we can make the following changes here:And for total cell add the condition to check for distance request, and only show scanning if it is not a distance request here:
What alternative solutions did you explore? (Optional)
Alternate solution 1:
We can also change the condition inside the isScanning function to check for distance requests, return false always if it is a distance request as distance requests are never scanned. For that we can make the following changes here:
App/src/libs/TransactionUtils/index.ts
Lines 1406 to 1414 in 5fc6b58
And here, we still need to fallback to transactionItem.merchant for distance request when getMerchant return '', so we need to make the following changes here:
App/src/components/TransactionItemRow/index.tsx
Line 151 in 5fc6b58
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
melvin-bot commentedon Mar 5, 2026
10 days overdue. Is anyone even seeing these? Hello?
melvin-bot commentedon Mar 10, 2026
This issue has not been updated in over 14 days. eroding to Weekly issue.
melvin-bot commentedon Apr 2, 2026
This issue has not been updated in over 15 days. eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Jun 15, 2026
@lanitochka17, this Monthly task hasn't been acted upon in 6 weeks; closing.
If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.