Skip to content

[Due for payment 2026-05-18] [Due for payment 2026-05-15] Distance - Edited distance reverts to default distance after submitting distance from self DM #89847

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.68-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: #85493
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:

  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. Go to Manual tab.
  7. Edit the distance and save it.
  8. Click Report field > Remove from report.
  9. Go to self DM.
  10. Open the distance expense.
  11. Click on the header > Submit it to someone.
  12. Select workspace chat.
    → Confirm page shows the edited distance from Step 7.
  13. Click Create expense.
  14. Open the expense.

Expected Result:

The edited distance will persist after submitting the distance expense from self DM.

Actual Result:

The edited distance reverts to default distance after submitting the distance expense from self DM.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7146599_1778109399872.6.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @aimane-chnaif

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 May 7, 2026
  2. melvin-bot commented on May 7, 2026

    @melvin-bot

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

  3. melvin-bot commented on May 7, 2026

    @melvin-bot

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

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

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #85493 - "Allowing distance to be edited while editing" by @mukhrr (High confidence)
    Related Issues: #83781 (the original issue this PR fixed)

    Recommendation: REVERT

    This PR introduced a regression in the distance editing flow. The edited distance reverts to the default route-calculated distance after the expense is removed from a report and re-submitted from the self DM. The fix requires changes to the App codebase, and the causing PR is clearly identifiable.

    Assigned: @mukhrr (PR author), @aimane-chnaif and @youssef-lr (approving reviewers)
    Labels: DeployBlockerCash kept (Frontend bug — App PR is the cause). DeployBlocker should be removed (no backend fix needed).

    Detailed Analysis

    Evidence

    Verification

    Files affected by the bug:

    • src/libs/actions/TransactionEdit.ts — backup/restore transaction logic
    • src/libs/actions/IOU/UpdateMoneyRequest.ts — distance update and optimistic data
    • src/libs/TransactionUtils/index.ts — getUpdatedTransaction distance branch
    • src/pages/iou/request/step/IOURequestStepDistance.tsx — distance step navigation and submit

    PR #85493 modifies all four of these files.

    Root Cause

    The PR made several changes to the distance backup/restore and submit flow that interact in a way that causes the regression:

    1. TransactionEdit.ts: The createBackupTransaction function was changed to check transactionBackup?.transactionID instead of just transactionBackup. This was intended to prevent "corrupted" partial-route backups from being restored. However, if the transaction backup legitimately lacks a transactionID field (e.g., during the "remove from report" flow where Onyx state may be partially updated), the backup check would fall through, overwriting the backup with the current (pre-edit) state instead of preserving the user's manual edit.

    2. IOURequestStepDistance.tsx: The navigation after save was changed from navigateBack() to navigateBackAfterSave() which calls Navigation.closeRHPFlow(). The removeBackupTransaction is now called eagerly before navigation completes. When the user removes the expense from a report and navigates to self DM, the sequence of backup creation and restoration may differ from the original flow, resulting in the original route-calculated distance being used rather than the manually saved value.

    3. UpdateMoneyRequest.ts: The logic for when to clear routes from the success data was made conditional. For pure distance edits (shouldClearRoutes = false), the routes are kept — but routes.route0.distance still holds the original map-calculated distance. Since getDistanceInMeters now prioritizes comment.customUnit.quantity over routes.route0.distance, the saved quantity should win. However, when the distance edit path is taken through the re-submission from self DM, the transaction data that reaches getUpdatedTransaction may not have the manually-edited quantity value if the backup was incorrectly restored.

    The interaction between these three changes produces the observed regression where the edited distance is lost after "Remove from report" + re-submit.

  6. removed
    DeployBlockerIndicates it should block deploying the API
    on May 7, 2026
  7. 2 remaining items

  8. francoisl commented on May 7, 2026

    @francoisl
    Contributor

    PR was reverted, going to close as the steps are no longer relevant.

  9. mukhrr commented on May 7, 2026

    @mukhrr
    Contributor

    Here we need BE fix too. Just leaving comment her not to lose later:

    Title: AddTrackedExpenseToPolicy should honor distance param when present

    Issue: When converting a tracked distance expense to a workspace expense via AddTrackedExpenseToPolicy, the BE recomputes the distance from waypoints and ignores the explicit distance param sent in the request. This drops the user's manually-edited distance.

    Repro:

    1. Workspace chat → create a manual distance expense (e.g. 81 mi route)
    2. Open expense → Distance → Manual tab → edit to 100 mi → Save
    3. Remove from report → expense moves to self DM
    4. Self DM → header → "Submit it to someone" → select workspace → Create

    Expected: The new workspace expense persists at 100 mi.
    Actual: Optimistically shows 100 mi, then reverts to 81 mi (BE-recomputed from waypoints) after the request settles.

    Payload sent (relevant fields):

    distance: 100
    waypoints: { waypoint0: ..., waypoint1: ..., waypoint2: ... }
    customUnitID: F30B8A66CFBE8
    customUnitRateID: 4DB25340F2F53
    merchant: "100.00 mi @ UZS0.725 / mi"
    

    Ask: When distance is present alongside waypoints in AddTrackedExpenseToPolicy, persist the explicit distance value as customUnit.quantity instead of recomputing it from waypoints. This matches the behavior of UpdateMoneyRequestDistance, which already honors the explicit distance param.

    Context: The FE fix landed in PR — it now sends the manually-edited distance through the convert flow. BE alignment is the last piece to make the manual edit fully persist across self-DM → workspace conversion.

  10. added and removed
    ReviewingHas a PR in review
    on May 8, 2026
  11. changed the title [-]Distance - Edited distance reverts to default distance after submitting distance from self DM[/-] [+][Due for payment 2026-05-15] Distance - Edited distance reverts to default distance after submitting distance from self DM[/+] on May 8, 2026
  12. melvin-bot commented on May 8, 2026

    @melvin-bot

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

  13. melvin-bot commented on May 8, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.68-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-05-15. 🎊

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

  14. melvin-bot commented on May 8, 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]

  15. changed the title [-][Due for payment 2026-05-15] Distance - Edited distance reverts to default distance after submitting distance from self DM[/-] [+][Due for payment 2026-05-18] [Due for payment 2026-05-15] Distance - Edited distance reverts to default distance after submitting distance from self DM[/+] on May 11, 2026
  16. 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:

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

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.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions