Skip to content

[Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Distance - Inconsistent behavior when saving distance in Map and Manual tab #90083

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.3.69-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: #89858
Email or phone of affected tester (no customers): isjndoijsdoosdoi@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:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create a map distance expense.
  4. Open the expense.
  5. Click Distance.
  6. Change the waypoint in Map tab. Do not save it yet.
  7. Go to Manual tab, edit the distance too and save it.
  8. Open Distance field.
    → Both changes in Map and Manual tab from Step 6 and 7 are saved.
  9. Go to Manual tab and edit the distance. Do not save it yet.
  10. Go to Map tab, change the waypoint and save it.
  11. Open Distance field.
    → Only the changes in Map tab from Step 9 are saved.

Expected Result:

In Step 8 and 10, when both Map and Manual distance are edited, app should save both changes or save the changes on the currently opened tab.

Actual Result:

In Step 8, when both Map and Manual distance are edited and user saves on Manual tab, both changes in Map and Manual tab from Step 6 and 7 are saved.

In Step 10, when both Map and Manual distance are edited and user saves on Map tab, only the changes in Map tab in Step 9 are saved.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7148707_1778268540759.19.mp4

View all open jobs on GitHub

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

Activity

  1. added
    DeployBlockerCash
    Daily
    on May 8, 2026
  2. added
    Bug
    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. MelvinBot commented on May 8, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The two tabs store their edits asymmetrically. The Map tab writes waypoint changes directly into the shared Onyx transaction object immediately when the user drags/edits a waypoint (no save required). The Manual tab stores its distance value only in a local React ref (manualNumberFormRef) that is invisible to any other code path until the Manual tab's own save runs.

    This causes:

    • Scenario 1 (Map edit → Manual save → both saved): submitManualDistance reads waypoints from Onyx, which already contains the unsaved Map edits, so it sends both the manual distance and the updated waypoints to updateMoneyRequestDistance.

    • Scenario 2 (Manual edit → Map save → manual changes lost): submitWaypoints calls updateMoneyRequestDistance without a distance parameter because it has no access to manualNumberFormRef. The manual distance is silently dropped.

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

    Make submitWaypoints also read and include the manual distance when saving, so both tabs' edits are always persisted regardless of which tab triggers the save.

    In submitWaypoints, read manualNumberFormRef.current?.getNumber() and, if it differs from the current transaction distance, pass it as the distance parameter to updateMoneyRequestDistance. This mirrors what submitManualDistance already does for waypoints (checking haveWaypointsChanged at line 623).

    What alternative solutions did you explore?

    1. Persist manual distance to Onyx as a draft field — would make both save paths symmetrical, but adds complexity to the data model for a problem that can be solved locally in the component.
    2. Reset unsaved state when switching tabs — would prevent cross-tab leaking entirely, but is a worse UX since users would lose their work when switching tabs.
    Related issues
    • Expensify/App#90082 — "Manual tab is not updated to new distance after adding a new waypoint" (likely related state-sync issue from the same PR)

    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.

  7. mukhrr commented on May 10, 2026

    @mukhrr
    Contributor

    Expected Result:
    In Step 8 and 10, when both Map and Manual distance are edited, app should save both changes or save the changes on the currently opened tab.

    @youssef-lr @aimane-chnaif What exactly is expected here? We should save changes from both tabs or save the change from only current tab? cc @trjExpensify

  8. trjExpensify commented on May 11, 2026

    @trjExpensify
    Contributor

    I think it would be best if editing the waypoints updates the mi/km in the manual distance tab. You're effectively resetting it when you do that.

    So I think this is how that would play out in a few cases for example:

    1. Create a map distance expense for A > B equivalent to 100 miles
    2. Open the expense > Distance > Map tab
    3. Change the waypoints to A > C equivalent to 80 miles
    4. Click the Manual tab > see 80 miles
    5. Save > 80 miles is saved.

    __

    1. Create a map distance expense for A > B equivalent to 100 miles
    2. Open the expense > Distance > Map tab
    3. Change the waypoints to A > C equivalent to 80 miles
    4. Click the Manual tab > see 80 miles
    5. Change 80 to 150 miles
    6. Save > 150 miles is saved.

    __

    1. Create a map distance expense for A > B equivalent to 100 miles
    2. Open the expense > Distance > Manual tab
    3. Change 100 to 150 miles
    4. Click the Map tab
    5. Update the waypoints to A > C equivalent to 80 miles
    6. Click the manual tab > see 80 miles
    7. Save > 80 miles is saved.

    __

  9. 10 remaining items

  10. melvin-bot commented on May 11, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  11. removed
    DeployBlockerCash
    on May 11, 2026
  12. added
    Daily
    and removed
    Reviewing
    Hourly
    on May 11, 2026
  13. changed the title [-][$250] Distance - Inconsistent behavior when saving distance in Map and Manual tab[/-] [+][Due for payment 2026-05-18] [$250] Distance - Inconsistent behavior when saving distance in Map and Manual tab[/+] on May 11, 2026
  14. melvin-bot commented on May 11, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. 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:

  16. 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]

  17. changed the title [-][Due for payment 2026-05-18] [$250] Distance - Inconsistent behavior when saving distance in Map and Manual tab[/-] [+][Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Distance - Inconsistent behavior when saving distance in Map and Manual tab[/+] on May 13, 2026
  18. 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:

  19. 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]

  20. lanitochka17 commented on May 13, 2026

    @lanitochka17
    Author

    Deploy Blocker ##90558 was identified to be related to the PR ##90131 that attempted to fix this issue.

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