You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-05-20] [Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint. #90082
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):ibellicotest+2250@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome App Component: Money Requests
Action Performed:
Prerequisite: Account has at least one workspace.
Open the staging.new.expensify.com website.
Open any workspace chat.
Create a map distance expense.
Open the just created expense.
Click on "Distance"
Add a new waypoint.
Navigate to "Manual" tab.
Note that distance is not updated and original amount is still displayed.
Expected Result:
"Manual" tab should be automatically updated to new distance after adding a new waypoint to expense.
Actual Result:
"Manual" tab still shows original distance after a new waypoint is added to expense. Distance is only updated on manual tab after saving and reopening it.
👋 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:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #89858 - "fixed manual distance tab blockers" by @mukhrr (High confidence) Related Issues: #83781
Recommendation: REVERT
PR #89858 introduced the Manual tab distance sync logic and is the direct cause of this regression. The issue is staging-only (new feature not in production), so a revert is the cleanest path to unblock the deploy. The PR author acknowledged in the PR body that a hide-the-tab fallback PR (#89976) exists if needed.
Assigned: @mukhrr (PR author), @aimane-chnaif@youssef-lr (approving reviewers) Labels: DeployBlockerCash kept (frontend App PR is the cause). No label changes made.
Affected files: src/pages/iou/request/step/IOURequestStepDistance.tsx and src/pages/iou/request/step/DistanceManualTabContent.tsx — both are modified by PR fixed manual distance tab blockers #89858.
PR fixed manual distance tab blockers #89858 confirmed to touch IOURequestStepDistance.tsx (+283/-84 lines) and introduces the new DistanceManualTabContent.tsx component (76 additions).
Root Cause
PR #89858 added a useEffect in IOURequestStepDistance.tsx (lines 216-228) to push the recalculated route distance into the Manual tab input when waypoints change. The logic uses a lastSyncedRouteDistance ref to detect "real" waypoint-driven recalculations and skip the initial load.
When the user adds a waypoint, getUpdatedTransaction sets routes.route0.distance to null (pending route fetch from backend). The effect runs with routeDistance == null, which triggers the early-return at line 217 and assigns lastSyncedRouteDistance.current = null. When the backend returns the new route and routeDistance becomes the new value, the guard at line 221 sees lastSyncedRouteDistance.current == null and skips the update — so manualNumberFormRef.current?.updateNumber() is never called, and the Manual tab keeps displaying the stale distance.
The fix would require preserving the pre-null value of lastSyncedRouteDistance across the pending (null) phase, so that the guard can correctly detect that a meaningful transition occurred when the route resolves.
When a waypoint is added/edited, saveWaypoint clears routes.route0.distance to null. The useEffect responsible for syncing the route distance into the Manual tab's form input tracks the last synced value via lastSyncedRouteDistance ref. When saveWaypoint nulls the distance, this ref becomes null. When the backend returns the new route with an updated distance, the guard on line 221 (lastSyncedRouteDistance.current == null) skips the update — it was designed to prevent overwriting a manually-entered distance after save, but it also prevents syncing a legitimately new route distance after waypoint changes.
Since NumberWithSymbolForm only reads its value prop on mount (via useState), the imperative updateNumber() call is the only mechanism to update the displayed value post-mount — and it never fires.
What changes do you think we should make in order to solve the problem?
In IOURequestStepDistance.tsx, the useEffect guard at line 221 needs to distinguish between two null→value transitions:
Post-save re-fetch (should skip) — user saved a manual distance, the route re-fetch returns a value, but we want to keep the user's manual value.
Waypoint change (should sync) — user added/edited a waypoint on the Map tab, the route re-fetch returns a genuinely new distance that should be pushed to the Manual tab.
The fix: when routeDistance transitions from null to a new non-null value, only skip the updateNumber call if isManuallyEditing.current is true (which is already guarded on line 217). When isManuallyEditing is false (meaning the null came from saveWaypoint clearing the route, not from the user typing), allow the null→value transition to call updateNumber. Concretely, remove the lastSyncedRouteDistance.current == null portion of the guard on line 221, keeping only the lastSyncedRouteDistance.current === routeDistance equality check (which prevents re-syncing the same value).
The existing isManuallyEditing guard on line 217 already protects against overwriting user input, so the null check is redundant for that purpose.
What alternative solutions did you explore? (Optional)
An alternative would be to make NumberWithSymbolForm reactive to prop changes via a useEffect that syncs the value prop into currentNumber state. However, this would be a larger change with broader impact and could introduce unintended re-renders or conflicts with the existing imperative updateNumber mechanism.
Investigation details
Data flow when bug occurs:
User adds a waypoint → saveWaypoint() sets routes.route0.distance = null and customUnit.quantity = null
routeDistance becomes null, the useEffect sets lastSyncedRouteDistance.current = null and returns early (line 217-219)
getDistanceInMeters returns 0, so currentDistance falls back to the backup transaction's old distance (line 200-201)
Backend returns new route via Pusher → routeDistance becomes the new value (e.g. 5000m)
useEffect fires: lastSyncedRouteDistance.current == null → guard on line 221 returns early → updateNumber() never called
Manual tab keeps showing the stale backup distance
Possibly related:#90056 (distance tab RHP back button behavior) and #90057 (map receipt preview after rate change) were filed around the same time against 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.
changed the title [-][$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/-][+][Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/+]on May 11, 2026
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:
@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]
changed the title [-][Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/-][+][Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/+]on May 13, 2026
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:
@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]
changed the title [-][Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/-][+][Due for payment 2026-05-20] [Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/+]on May 13, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.73-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@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]
Activity
melvin-bot commentedon May 8, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #89858
melvin-bot commentedon May 8, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 8, 2026
👋 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:
OSBotify commentedon May 8, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #89858 - "fixed manual distance tab blockers" by @mukhrr (High confidence)
Related Issues: #83781
Recommendation: REVERT
PR #89858 introduced the Manual tab distance sync logic and is the direct cause of this regression. The issue is staging-only (new feature not in production), so a revert is the cleanest path to unblock the deploy. The PR author acknowledged in the PR body that a hide-the-tab fallback PR (#89976) exists if needed.
Assigned: @mukhrr (PR author), @aimane-chnaif @youssef-lr (approving reviewers)
Labels:
DeployBlockerCashkept (frontend App PR is the cause). No label changes made.Detailed Analysis
Evidence
Verification
src/pages/iou/request/step/IOURequestStepDistance.tsxandsrc/pages/iou/request/step/DistanceManualTabContent.tsx— both are modified by PR fixed manual distance tab blockers #89858.IOURequestStepDistance.tsx(+283/-84 lines) and introduces the newDistanceManualTabContent.tsxcomponent (76 additions).Root Cause
PR #89858 added a
useEffectinIOURequestStepDistance.tsx(lines 216-228) to push the recalculated route distance into the Manual tab input when waypoints change. The logic uses alastSyncedRouteDistanceref to detect "real" waypoint-driven recalculations and skip the initial load.The bug is in the guard condition at line 221:
When the user adds a waypoint,
getUpdatedTransactionsetsroutes.route0.distanceto null (pending route fetch from backend). The effect runs withrouteDistance == null, which triggers the early-return at line 217 and assignslastSyncedRouteDistance.current = null. When the backend returns the new route androuteDistancebecomes the new value, the guard at line 221 seeslastSyncedRouteDistance.current == nulland skips the update — somanualNumberFormRef.current?.updateNumber()is never called, and the Manual tab keeps displaying the stale distance.The fix would require preserving the pre-null value of
lastSyncedRouteDistanceacross the pending (null) phase, so that the guard can correctly detect that a meaningful transition occurred when the route resolves.MelvinBot commentedon May 8, 2026
Proposal
What is the root cause of that problem?
When a waypoint is added/edited,
saveWaypointclearsroutes.route0.distancetonull. TheuseEffectresponsible for syncing the route distance into the Manual tab's form input tracks the last synced value vialastSyncedRouteDistanceref. WhensaveWaypointnulls the distance, this ref becomesnull. When the backend returns the new route with an updated distance, the guard on line 221 (lastSyncedRouteDistance.current == null) skips the update — it was designed to prevent overwriting a manually-entered distance after save, but it also prevents syncing a legitimately new route distance after waypoint changes.Since
NumberWithSymbolFormonly reads itsvalueprop on mount (viauseState), the imperativeupdateNumber()call is the only mechanism to update the displayed value post-mount — and it never fires.What changes do you think we should make in order to solve the problem?
In
IOURequestStepDistance.tsx, theuseEffectguard at line 221 needs to distinguish between two null→value transitions:The fix: when
routeDistancetransitions fromnullto a new non-null value, only skip theupdateNumbercall ifisManuallyEditing.currentistrue(which is already guarded on line 217). WhenisManuallyEditingisfalse(meaning the null came fromsaveWaypointclearing the route, not from the user typing), allow the null→value transition to callupdateNumber. Concretely, remove thelastSyncedRouteDistance.current == nullportion of the guard on line 221, keeping only thelastSyncedRouteDistance.current === routeDistanceequality check (which prevents re-syncing the same value).The existing
isManuallyEditingguard on line 217 already protects against overwriting user input, so the null check is redundant for that purpose.What alternative solutions did you explore? (Optional)
An alternative would be to make
NumberWithSymbolFormreactive to prop changes via auseEffectthat syncs thevalueprop intocurrentNumberstate. However, this would be a larger change with broader impact and could introduce unintended re-renders or conflicts with the existing imperativeupdateNumbermechanism.Investigation details
Data flow when bug occurs:
saveWaypoint()setsroutes.route0.distance = nullandcustomUnit.quantity = nullrouteDistancebecomesnull, the useEffect setslastSyncedRouteDistance.current = nulland returns early (line 217-219)getDistanceInMetersreturns 0, socurrentDistancefalls back to the backup transaction's old distance (line 200-201)routeDistancebecomes the new value (e.g. 5000m)lastSyncedRouteDistance.current == null→ guard on line 221 returns early →updateNumber()never calledKey files:
IOURequestStepDistance.tsx:216-228— the buggy useEffectTransaction.ts:132-158— saveWaypoint nulling the distancegetDistanceInMeters.ts:10-19— distance calculation priorityPossibly related: #90056 (distance tab RHP back button behavior) and #90057 (map receipt preview after rate change) were filed around the same time against the same PR.
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon May 8, 2026
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 remaining items
[-][$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/-][+][Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/+]melvin-bot commentedon May 11, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon May 11, 2026
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:
melvin-bot commentedon May 11, 2026
@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]
fix: resolve distance edit RHP regressions (#90037, #90056, #90082)
[-][Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/-][+][Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/+]melvin-bot commentedon May 13, 2026
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:
melvin-bot commentedon May 13, 2026
@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]
melvin-bot commentedon May 13, 2026
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.
lanitochka17 commentedon May 13, 2026
Deploy Blocker ##90558 was identified to be related to the PR ##90131 that attempted to fix this issue.
[-][Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/-][+][Due for payment 2026-05-20] [Due for payment 2026-05-20] [Due for payment 2026-05-18] [$250] Expense - Manual tab is not updated to new distance after adding a new waypoint.[/+]melvin-bot commentedon May 13, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.73-4 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:
melvin-bot commentedon May 13, 2026
@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]