Skip to content

[Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Distance - Map receipt preview changes to placeholder after changing distance rate #90057

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.69-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: #89858
Email or phone of affected tester (no customers): josdjnosdjionjsdonjisod@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Enable Distance rates in workspace settings.
  • Have at least two distance rates.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create a distance expense.
  4. Open the expense.
  5. Click Rate.
  6. Select another rate.

Expected Result:

New map receipt will be generated after changing distance rate.

Actual Result:

Map receipt preview changes to placeholder after changing distance rate.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7148511_1778256507636.16.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022053963800901760991
  • Upwork Job ID: 2053963800901760991
  • Last Price Increase: 2026-05-11
Issue OwnerCurrent Issue Owner: @aimane-chnaif

Activity

  1. added
    DeployBlockerCash
    on May 8, 2026
  2. added
    Daily
    Bug
    DeployBlocker
    on May 8, 2026
  3. melvin-bot commented on May 8, 2026

    @melvin-bot

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

  4. melvin-bot commented on May 8, 2026

    @melvin-bot

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

  5. github-actions commented on May 8, 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 May 8, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #89858 - "fixed manual distance tab blockers" by @mukhrr (High confidence)
    Related Issues: #83781 (original issue PR #89858 was fixing)

    Recommendation: REVERT

    PR #89858 introduced a regression where changing a distance rate clears the route coordinates and then renders ConfirmedRoute with requireRouteToDisplayMap={true}, causing the map to fall back to PendingMapView (the placeholder) instead of showing the map receipt.

    Assigned: @mukhrr (PR author), @aimane-chnaif (approving reviewer), @youssef-lr (approving reviewer) from PR #89858
    Labels: DeployBlockerCash kept (frontend App PR caused the bug), DeployBlocker kept (both labels were already present — not removing either until root cause is fully confirmed on both sides)

    Detailed Analysis

    Evidence

    Verification

    • Affected files: src/libs/actions/IOU/UpdateMoneyRequest.ts and src/components/ReportActionItem/ReportActionItemImage.tsx
    • Confirmation: PR fixed manual distance tab blockers #89858 modifies both of these files directly

    Root Cause

    PR #89858 introduced two changes that combine to produce the placeholder:

    1. Route clearing on rate change (UpdateMoneyRequest.ts): The PR added shouldClearRoutes = (hasWaypointAddressesChanged || hasModifiedDistanceRate) && !hasValidOptimisticRoute. When the user selects a new distance rate, hasModifiedDistanceRate = true and hasValidOptimisticRoute = false (no new route was calculated — only the rate changed). As a result, on API success, routes: null is written to Onyx, clearing the route coordinates.

    2. Forced ConfirmedRoute rendering while coordinates are gone (ReportActionItemImage.tsx): The PR added hasPendingReceiptRegeneration which checks pendingFields.merchant or pendingFields.customUnitRateID. When a rate change is pending, showMapAsImage = true, which renders ConfirmedRoute with requireRouteToDisplayMap={true}. However, because step 1 already cleared routes: null, ConfirmedRoute has no coordinates (hasCoordinates = false), so shouldDisplayMap = false and it falls through to PendingMapView — the placeholder.

    The combination means: rate change → clears route → pending flag shows ConfirmedRoute → no coordinates → placeholder shown, persisting until the Pusher push delivers a fresh receipt (which may be delayed or missed).

    A targeted fix would be to not clear routes on a pure rate change (since the route geometry does not change when only the rate changes — only the amount changes). Alternatively, shouldClearRoutes should exclude hasModifiedDistanceRate from triggering route clearing, since rate-only changes do not require a new map to be generated.

  7. removed
    DeployBlocker
    on May 8, 2026
  8. MelvinBot commented on May 8, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When a distance rate is changed, the successData handler simultaneously clears pendingFields and sets routes to null:

    const shouldClearRoutes = (hasWaypointAddressesChanged || hasModifiedDistanceRate) && !hasValidOptimisticRoute;

    Once pendingFields are cleared, hasPendingReceiptRegeneration becomes false, so the component stops rendering ConfirmedRoute (the live map) and falls through to the static receipt.source URL. But the server has already invalidated the old receipt URL (it now 404s) and the new URL hasn't arrived via Pusher yet — so a placeholder is shown.

    This was introduced in PR #89858 which added hasModifiedDistanceRate to the shouldClearRoutes condition.

    What changes do you think we should make in order to solve the problem?

    Remove hasModifiedDistanceRate from the shouldClearRoutes condition at UpdateMoneyRequest.ts:1316:

    - const shouldClearRoutes = (hasWaypointAddressesChanged || hasModifiedDistanceRate) && !hasValidOptimisticRoute;
    + const shouldClearRoutes = hasWaypointAddressesChanged && !hasValidOptimisticRoute;
    

    When only the rate changes, the route geometry (waypoints, path coordinates) is unchanged — only the receipt image needs server-side regeneration. Clearing routes is unnecessary for rate-only changes and creates the gap where neither the map component nor the receipt image can display. The Pusher push will deliver the updated receipt.source when ready, at which point pendingFields are already clear and the static image path renders correctly.

    What alternative solutions did you explore? (Optional)

    An alternative is to keep pendingFields.merchant set through the success callback (not clearing it until the Pusher push arrives with the new receipt URL). This would keep hasPendingReceiptRegeneration true and ConfirmedRoute rendering. However, this is riskier — if the Pusher push is missed or delayed, the pending flag would persist indefinitely, leaving the receipt stuck on the live map view instead of switching to the static image. The current approach of clearing merchant in successData (line 1004-1005) is the safer fallback pattern. The simpler fix of just not clearing routes for rate changes avoids this tradeoff entirely.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  9. 6 remaining items

  10. melvin-bot commented on May 11, 2026

    @melvin-bot
  11. removed
    Reviewing
    on May 11, 2026
  12. Beamanator commented on May 11, 2026

    @Beamanator
    Contributor

    PR merged, working on a CP

  13. Beamanator commented on May 11, 2026

    @Beamanator
    Contributor

    Looks like this is working well in latest staging!

    Screen.Recording.2026-05-11.at.5.21.27.PM.mov
  14. removed
    DeployBlockerCash
    on May 11, 2026
  15. added
    Daily
    and removed
    Hourly
    on May 11, 2026
  16. changed the title [-][$250] Distance - Map receipt preview changes to placeholder after changing distance rate[/-] [+][Due for payment 2026-05-18] [$250] Distance - Map receipt preview changes to placeholder after changing distance rate[/+] on May 11, 2026
  17. melvin-bot commented on May 11, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.69-18 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-05-18. 🎊

    For reference, here are some details about the assignees on this issue:

  18. melvin-bot commented on May 11, 2026

    @melvin-bot

    @aimane-chnaif The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  19. changed the title [-][Due for payment 2026-05-18] [$250] Distance - Map receipt preview changes to placeholder after changing distance rate[/-] [+][Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Distance - Map receipt preview changes to placeholder after changing distance rate[/+] on May 13, 2026
  20. melvin-bot commented on May 13, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.72-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-05-20. 🎊

    For reference, here are some details about the assignees on this issue:

  21. melvin-bot commented on May 13, 2026

    @melvin-bot

    @aimane-chnaif The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

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

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions