Skip to content

Commit a313575

Browse files
committed
fix(scan): stop amount flicker on field edit
1 parent 62689ba commit a313575

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/libs/TransactionUtils/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,11 @@ function isPartialMerchant(merchant: string): boolean {
558558
}
559559

560560
function isFailedScanAmountPlaceholder(transaction: OnyxEntry<Transaction>) {
561+
// OPEN is included since editing another field (e.g. merchant) optimistically flips receipt.state to OPEN,
562+
// which would otherwise flicker the amount back to "$0.00" until the server confirms it's still missing.
561563
return (
562564
isScanRequest(transaction) &&
563-
transaction?.receipt?.state === CONST.IOU.RECEIPT_STATE.SCAN_FAILED &&
565+
(transaction?.receipt?.state === CONST.IOU.RECEIPT_STATE.SCAN_FAILED || transaction?.receipt?.state === CONST.IOU.RECEIPT_STATE.OPEN) &&
564566
(transaction?.amount === 0 || transaction?.amount === undefined) &&
565567
!hasValidModifiedAmount(transaction)
566568
);

0 commit comments

Comments
 (0)