Skip to content

Expense-Inconsistent amount display in expense preview and details when manual expense is 0.00 #98784

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.4.54-2
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #96772
Email or phone of affected tester (no customers): sjdoinsjdnoijnsdojo@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create a manual expense with amount 0.00.
    → Expense preview does not show amount.
  4. Open the expense.
    → Amount field shows 0.00 despite not showing amount on expense preview.

Expected Result:

In Step 3, expense preview should show 0.00 because user manually creates expense with 0.00 amount.

Actual Result:

In Step 3, expense preview shows 0.00 when user manually creates expense with 0.00 amount.
In Step 4, Amount field shows 0.00 instead of empty field as the expense preview does not show any amount.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7235675_1786983656999.10.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 17, 2026
  2. melvin-bot commented on Aug 17, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #96772

  3. melvin-bot commented on Aug 17, 2026

    @melvin-bot

    @arosiclair @Ollyws you have been assigned to this deploy blocker because you reviewed the offending PR: #96772

  4. melvin-bot commented on Aug 17, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Aug 17, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. MelvinBot commented on Aug 17, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #96772 - "fix: show scan error instead of populating $0 amount when scan fails" by @x-dev90 (High confidence)
    Related Issues: #94494 (the issue #96772 was fixing)

    Recommendation: ROLL FORWARD

    A one-line targeted fix is safer than a revert: reverting would reintroduce the original $0.00-on-failed-scan bug that #96772 fixed (#94494). The preview should use the same narrow failed-scan check the details view already uses.

    Assigned: @x-dev90 (PR author), @arosiclair and @Ollyws (approving reviewers) from causing PR #96772
    Labels: No changes. DeployBlockerCash kept (App deploy is blocked, App PR is the cause). No DeployBlocker present.

    📋 Detailed Analysis

    Evidence

    Verification

    Affected files, all modified by #96772:

    • src/libs/TransactionPreviewUtils.ts — new preview amount-blanking branch:
      } else if (hasFieldErrors && isAmountMissing(transaction, isExpenseReport(iouReport))) {
      displayAmountText = {text: ''};
    • src/libs/TransactionUtils/index.ts — isAmountMissing / isFailedScanAmountPlaceholder / areRequiredFieldsEmpty:
      function isFailedScanAmountPlaceholder(transaction: OnyxEntry<Transaction>) {
      return (
      isScanRequest(transaction) &&
      transaction?.receipt?.state === CONST.IOU.RECEIPT_STATE.SCAN_FAILED &&
      (transaction?.amount === 0 || transaction?.amount === undefined) &&
      !hasValidModifiedAmount(transaction)
      );
      }
      function isAmountMissing(transaction: OnyxEntry<Transaction>, isFromExpenseReport = true) {
      if (isFailedScanAmountPlaceholder(transaction)) {
      return true;
      }
      if (isFromExpenseReport) {
      return transaction?.amount === undefined && (transaction?.modifiedAmount === undefined || transaction?.modifiedAmount === '');
      }
      return (transaction?.amount === 0 || transaction?.amount === undefined) && !hasValidModifiedAmount(transaction);
      }
    • src/components/ReportActionItem/MoneyRequestView.tsx — details view uses the narrow isFailedScanAmountPlaceholder (which is why details still correctly show 0.00).

    Root Cause

    For a manual $0.00 expense in a self DM (a non-expense-report context):

    1. The details view (MoneyRequestView.tsx) blanks the amount only when isFailedScanAmountPlaceholder(transaction) is true. A manual expense is not a scan request, so this is false → details correctly show 0.00.
    2. The preview (TransactionPreviewUtils.ts L381-382) instead blanks the amount when hasFieldErrors && isAmountMissing(transaction, isExpenseReport(iouReport)):
      • isExpenseReport(iouReport) is false for a self DM, so isAmountMissing falls to its non-expense-report branch: (amount === 0 || amount === undefined) && !hasValidModifiedAmount(transaction). For a manual $0.00, amount === 0 and there is no modifiedAmount → returns true.
      • hasFieldErrors = hasMissingSmartscanFields → areRequiredFieldsEmpty, which fix: show scan error instead of populating $0 amount when scan fails #96772 also rewrote to call isAmountMissing(...), so it is likewise true for the manual $0.00.
      • Both true → displayAmountText = {text: ''} → preview renders no amount.

    So a legitimate, user-entered $0.00 is wrongly treated as a "missing amount" in the preview, while the details view (using the narrow scan-failure check) shows 0.00 — the exact inconsistency reported.

    Suggested targeted fix

    Align the preview with the details view by gating the blank on the failed-scan placeholder rather than the broad isAmountMissing:

    // src/libs/TransactionPreviewUtils.ts
    } else if (isFailedScanAmountPlaceholder(transaction)) {
        displayAmountText = {text: ''};
    }

    isFailedScanAmountPlaceholder requires isScanRequest && receipt.state === SCAN_FAILED, so a manual $0.00 is left displaying 0.00 while failed scans still render blank as #96772 intended. (Author/reviewers should confirm this preserves the split/confirmation and areRequiredFieldsEmpty behavior the PR also changed.)

  7. MelvinBot commented on Aug 17, 2026

    @MelvinBot
    Contributor

    ✅ Reproduced on web + root cause confirmed

    I reproduced this end-to-end on a web build and confirmed the root cause in the investigation above.

    What I saw: creating a manual 0.00 expense in a self DM renders the chat preview with a red "Missing amount" flag and no amount shown, while opening the expense shows Amount: 0.00 in the details — the exact preview↔details inconsistency reported.

    Preview bubble — no amount, "Missing amount"Expense details — Amount shows 0.00

    Cause: #96772 (high confidence, staging-only). The preview blanks the amount via the broad hasFieldErrors && isAmountMissing(...) predicate (TransactionPreviewUtils.ts:381-382), which in a self DM (non-expense-report) treats a legitimate user-entered 0.00 as "missing". The details view uses the narrow isFailedScanAmountPlaceholder check, so it still shows 0.00.

    Recommendation: ROLL FORWARD — gate the preview blank on isFailedScanAmountPlaceholder(transaction) (matching the details view) rather than the broad isAmountMissing. Reverting would reintroduce the original 0.00-on-failed-scan bug (#94494) that #96772 fixed.

    Test currency was EUR on this account; the 0.00 discrepancy is identical to the reported $0.00 case.

  8. m-natarajan commented on Aug 18, 2026

    @m-natarajan

    Not repro, Win 11/Chrome, v9.4.54-4

    Recording.3380.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions