Skip to content

[Due for payment 2026-10-28] Amount&Distance field not load after change workspace&reselect route when exclusion is enabled #103293

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.4-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #102258
Email or phone of affected tester (no customers): applausetester+ssndjois2jd1@applause.expensifail.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:

Precondition:

  • Enable commuterExclusions beta.
  • Home address - East 45th Street, Los Angeles, CA, 90012, US
  • Create two workspaces - A and B.
  • For workspace A only,
    • Company address - 123 South Figueroa Street, Los Angeles, CA 90012
    • Enable Distance rates.
    • Enable Exclude usual commutes in Distance rates > Settings > Exclude commutes.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat A.
  3. Click + > Track distance > Map.
  4. Enter home address and company address.
  5. Click Next > Create expense.
  6. Open FAB > Track distance > Map.
  7. Click Reuse route.
  8. Select the previous route.
  9. Click To field and select workspace chat B.
  10. Click RHP back button.
  11. Reselect the previous route.

Expected Result:

Amount and Distance field will load after changing workspace and reselecting route when commuter exclusion is enabled.

Actual Result:

Amount and Distance field do not load after changing workspace and reselecting route when commuter exclusion is enabled.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7279747_1791357851574.18.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7279747

Issue OwnerCurrent Issue Owner: @Pujan92

Activity

  1. added
    DeployBlockerCash
    Bug
    on Oct 7, 2026
  2. applause-bot commented on Oct 7, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/8e70a0edef4bbe7d1263cfa095aba1a14c0a2765c4024dabe9ff0166f4391852

  3. melvin-bot commented on Oct 7, 2026

    @melvin-bot

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

  4. github-actions commented on Oct 7, 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.
  5. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    @Gonals @Pujan92 you have been assigned to this deploy blocker because you reviewed the offending PR: #102258

  6. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    @ShridharGoel you have been assigned to this deploy blocker because you authored the offending PR: #102258

  7. melvin-bot commented on Oct 7, 2026

    @melvin-bot

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

  8. MelvinBot commented on Oct 7, 2026

    @MelvinBot
    Contributor

    Deploy Blocker Analysis

    Causing PR: [Payment due @Pujan92] Add Reuse route to the distance creation flow (medium-high confidence, from reading the code; not reproduced).

    Root cause: The PR added a blanket !transaction?.isReusedRoute && guard to the route fetch condition in src/hooks/useFetchRoute.ts:44-48. That guard also blocks the refetch that gets the commute-exclusion result after you switch workspaces. Without that result, the confirmation page treats the route as pending forever, so Amount and Distance stay blank.

    Recommendation: Roll forward with a small fix in useFetchRoute.ts. Revert only if the fix can't be cherry-picked in time. The PR touches 39 files, and Fix map interaction, empty waypoint compaction and add reuse routes beta gate already builds on it.

    const isReusedRoute = !!transaction?.isReusedRoute;
    // A reused route has the server distance but no map geometry, so count its quantity as a route.
    const hasRoute = hasRouteTransactionUtils(transaction, isReusedRoute);
    ...
    const shouldFetchRoute =
        isMapDistanceRequest &&
        // A reused route already has its distance; only the commute result for the current workspace may be missing.
        (isReusedRoute ? isCommuterExclusionPreviewStale : isRouteAbsentWithoutErrors || haveValidatedWaypointsChanged || isCommuterExclusionPreviewStale) &&
        !isLoadingRoute &&
        Object.keys(validatedWaypoints).length > 1;
    Investigation details
    1. Picking a reused route clears the exclusion result. selectReusableRoute calls updateWaypoints, which clears routes and commuterExclusionPreview (Transaction.ts:488-495). It then sets isReusedRoute: true and the distance, but saved routes have no exclusion result.
    2. The confirmation page waits for that result. For a workspace that uses home-and-office exclusion and has no matching result, useDistanceRequestState.ts:119-127 marks the route pending. Pending blanks the amount (useConfirmationAmount.ts:89-90) and hides the distance (DistanceConfirmationList.tsx:54).
    3. No fetch can fix it. isCommuterExclusionPreviewStale exists for the "member has since switched workspace" case (useFetchRoute.ts:36-43). The new guard blocks it. It also needs hasRoute, and line 28 only checks map geometry, which is now cleared. That's why the fix passes isReusedRoute to hasRoute, which then counts the saved distance as a route.

    Why the first selection loads (likely, not confirmed): selectReusableRoute writes in two steps. In between, isReusedRoute is false and routes is empty, so the map screen still mounted underneath can fire a fetch. If that fetch matches the confirmation workspace, the page loads. After switching "To" to workspace B and back, the workspaces no longer match, and the guard blocks recovery.

    Before merging the fix:

    • Confirm whether the route response overwrites comment.customUnit.quantity. If it does, the reused distance is replaced with a freshly computed one for the same waypoints, which is probably fine.
    • Consider making selectReusableRoute a single Onyx merge to remove the in-between state.
    • Add a unit test: a draft with isReusedRoute: true, a quantity, no routes, a home-and-office workspace, and no matching result calls getRoute once with that workspace ID. With a matching result, it does not call getRoute.

    Scope: The bug only affects workspaces with "Exclude usual commutes" enabled, which needs the commuterExclusions beta. The beta gate in the follow-up PR would limit exposure further.


    Next Steps: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.


    view run

  9. 2 remaining items

  10. added
    Daily
    and removed
    Hourly
    on Oct 7, 2026
  11. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    @Pujan92, @Gonals, @ShridharGoel Huh... This is 4 days overdue. Who can take care of this?

  12. melvin-bot commented on Oct 14, 2026

    @melvin-bot

    @Pujan92, @Gonals, @ShridharGoel 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  13. Gonals commented on Oct 15, 2026

    @Gonals
    Contributor

    @ShridharGoel, are you working on this?

  14. ShridharGoel commented on Oct 15, 2026

    @ShridharGoel
    Contributor

    Yes this should be fixed by #103654

  15. added
    Reviewing
    on Oct 15, 2026
  16. m-natarajan commented on Oct 21, 2026

    @m-natarajan

    Not repro web Chrome v9.5.15-2

    20261021_213157.mp4
  17. removed
    Reviewing
    on Oct 21, 2026
  18. changed the title [-]Amount&Distance field not load after change workspace&reselect route when exclusion is enabled[/-] [+][Due for payment 2026-10-28] Amount&Distance field not load after change workspace&reselect route when exclusion is enabled[/+] on Oct 21, 2026
  19. melvin-bot commented on Oct 21, 2026

    @melvin-bot

    @Pujan92

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.15-3 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-10-28. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ 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]. If no checklist is needed for this issue, you can click: [no checklist 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