Skip to content

[Awaiting payment 2026-02-18][$125] Expense - Blank distance field is shown when submitting expense with zero distance #80060

Closed

Description

@mitarachim

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.3.5-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #79917
Email or phone of affected tester (no customers): applausetester+bm1040@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Web, android
App Component: Money Requests

Action Performed:

Precondition -
use expensifail account

  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Click +.> Track distance > Manual.
  4. Enter 0 > Next.
  5. Click Create expense.
  6. Go to Account > Troubleshoot > Clear cache and restart > Reset and refresh.
  7. Go back to self DM.
  8. Click Submit it to someone.
  9. Select workspace chat.
  10. On confirm page, click Rate and select workspace rate.
  11. Click Create expense.
  12. Open the distance expense.

Expected Result:

The distance field should show 0.00 miles

Actual Result:

The distance field is empty instead of showing 0.00 miles.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7054343_1768945898432.bandicam_2026-01-21_00-34-02-636.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022013948358503213014
  • Upwork Job ID: 2013948358503213014
  • Last Price Increase: 2026-01-28
Issue OwnerCurrent Issue Owner: @

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Jan 21, 2026
  2. melvin-bot commented on Jan 21, 2026

    @melvin-bot

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

  3. melvin-bot commented on Jan 21, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jan 21, 2026

    @melvin-bot

    Triggered auto assignment to @laurenreidexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  5. github-actions commented on Jan 21, 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. OSBotify commented on Jan 21, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #79917 - "Use existing functions to check if request is distance" by @Gonals (High confidence)
    Related Issues: #79719 (issue that PR #79917 was fixing)

    Recommendation: ROLL FORWARD

    PR #79917 successfully fixed issue #79719 (showing Distance/Rate fields instead of Merchant field when distance is 0), but exposed a pre-existing bug in the DistanceRequestUtils.getDistanceForDisplay() function. A simple fix to handle zero distance values correctly is needed, rather than reverting the PR which would reintroduce the original bug.

    Labels: Keeping DeployBlockerCash (this is a frontend bug requiring an App fix)

    📋 Detailed Analysis

    Evidence

    PR #79917 changed how isDistanceRequest and isManualDistanceRequest are determined in src/libs/actions/IOU/index.ts. Instead of inline checks, it now uses utility functions from TransactionUtils:

    // Before:
    const isDistanceRequest =
        existingTransaction &&
        (existingTransaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE ||
         existingTransaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_MAP ||
         existingTransaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_MANUAL ||
         existingTransaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_ODOMETER);
    
    // After:
    const isDistanceRequest = existingTransaction && isDistanceRequestTransactionUtils(existingTransaction);

    This change correctly identifies distance requests with zero distance, which causes the Distance/Rate fields to be displayed (fixing #79719). However, it exposed a bug that was already present in the codebase.

    Verification

    The bug is in /home/runner/work/App/App/src/libs/DistanceRequestUtils.ts at lines 185-186:

    function getDistanceForDisplay(...) {
        if (!hasRoute || !unit) {
            return translate(\"iou.fieldPending\");
        }
    
        if (!distanceInMeters) {  // ← BUG: This returns empty string when distance is 0
            return \"\";
        }
    
        const distanceInUnits = getRoundedDistanceInUnits(distanceInMeters, unit);
        // ... rest of function
    }

    When distanceInMeters is 0, the condition !distanceInMeters evaluates to true, causing the function to return an empty string instead of formatting and displaying "0.00 miles" (or km).

    Root Cause

    The issue is that the code uses a truthy check (!distanceInMeters) instead of explicitly checking for null or undefined. In JavaScript, 0 is falsy, so the condition incorrectly treats zero distance as "no distance".

    Fix needed: Change line 185 to:

    if (distanceInMeters === null || distanceInMeters === undefined) {
        return \"\";
    }

    Or more simply:

    if (distanceInMeters == null) {
        return \"\";
    }

    This will allow zero distances to be displayed correctly while still returning empty string for truly missing values.

  7. 36 remaining items

  8. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed
    ReviewingHas a PR in review
    on Feb 11, 2026
  9. changed the title [-][$125] Expense - Blank distance field is shown when submitting expense with zero distance[/-] [+][Awaiting payment 2026-02-18][$125] Expense - Blank distance field is shown when submitting expense with zero distance[/+] on Feb 11, 2026
  10. laurenreidexpensify commented on Feb 13, 2026

    @laurenreidexpensify
    Contributor

    note to self: everyone is paid via ND

  11. mallenexpensify commented on Feb 18, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    (specifically for @dominictb since they moved to BE team)
    Contributor+: @dominictb due $75 via NewDot

  12. laurenreidexpensify commented on Feb 20, 2026

    @laurenreidexpensify
    Contributor

    Payment Summary

  13. twisterdotcom commented on Feb 23, 2026

    @twisterdotcom
    Contributor

    @dominictb has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-0b81-a750-a6df-325626f8eb34
  14. dominictb commented on Feb 24, 2026

    @dominictb
    Contributor

    @twisterdotcom That's right. The amount should be $75. My mistake.

  15. trjExpensify commented on Feb 25, 2026

    @trjExpensify
    Contributor

    approved $125 for @nyomanjyotisa.

  16. garrettmknight commented on Feb 25, 2026

    @garrettmknight
    Contributor

    $125 approved for @hoangzinh

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions