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-11] Odometer-Discard changes modal is shown after refreshing the browser and navigating away #89008
Version Number: 9.3.62-10 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#88702 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: MacBook Air 15.7.4 Chrome App Component: Money Requests
Action Performed:
Open the NewDot app on web
Click the FAB -> Track Distance -> switch to the Odometer tab
Enter a start odometer reading and capture a start odometer image
Enter an end odometer reading and capture an end odometer image
Refresh the browser
Click outside the modal or on the back button
Expected Result:
"Discard changes?" modal does not appear since the changes were removed after refreshing the browser
Actual Result:
"Discard changes?" modal appears when navigating away from Odometer flow after refreshing the browser
👋 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.
A race condition between async Onyx state clearing and synchronous component initialization after browser refresh.
When the user refreshes on the confirmation screen, useRestartOnOdometerImagesFailure detects expired blob URLs and calls clearOdometerDraftTransactionState followed immediately by navigateToStartMoneyRequestStep. However, clearOdometerDraftTransactionState fires five separate async Onyx.merge calls and returns void — it does not await completion.
When IOURequestStepDistanceOdometer re-mounts, the initial refs useEffect sets initialStartReadingRef/initialEndReadingRef to '' (Onyx data hasn't arrived yet). Then the stale transaction draft (with old odometer readings) arrives from Onyx before the null merges flush, and the second useEffect populates startReadingRef/endReadingRef with those stale values. Now getHasUnsavedChanges returns true because startReadingRef !== initialStartReadingRef, triggering the discard modal.
What changes do you think we should make in order to solve the problem?
Make clearOdometerDraftTransactionState return Promise.all of its Onyx operations, and await it in useRestartOnOdometerImagesFailure before calling navigateToStartMoneyRequestStep. This ensures the draft transaction state is fully cleared before the odometer component re-mounts, so the initial refs and current refs will both be empty — no false dirty state.
What alternative solutions did you explore? (Optional)
Pass a route param from the hook to signal "redirected from blob failure" and have the odometer component skip the discard check when that param is set. This works but adds coupling between the navigation param and the discard logic.
Delay the initial refs initialization until Onyx has settled (e.g., wait a tick). This is fragile and timing-dependent.
The await approach is cleanest because it fixes the root cause (navigating before state is cleared) rather than working around the symptom.
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 [-]Odometer-Discard changes modal is shown after refreshing the browser and navigating away[/-][+][Due for payment 2026-05-11] Odometer-Discard changes modal is shown after refreshing the browser and navigating away[/+]on May 4, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.65-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@DylanDylann 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 Apr 27, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #88702
melvin-bot commentedon Apr 27, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Apr 27, 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:
melvin-bot commentedon Apr 27, 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.
MelvinBot commentedon Apr 27, 2026
Proposal
What is the root cause of that problem?
A race condition between async Onyx state clearing and synchronous component initialization after browser refresh.
When the user refreshes on the confirmation screen,
useRestartOnOdometerImagesFailuredetects expired blob URLs and callsclearOdometerDraftTransactionStatefollowed immediately bynavigateToStartMoneyRequestStep. However,clearOdometerDraftTransactionStatefires five separate asyncOnyx.mergecalls and returnsvoid— it does not await completion.When
IOURequestStepDistanceOdometerre-mounts, the initial refs useEffect setsinitialStartReadingRef/initialEndReadingRefto''(Onyx data hasn't arrived yet). Then the stale transaction draft (with old odometer readings) arrives from Onyx before the null merges flush, and the second useEffect populatesstartReadingRef/endReadingRefwith those stale values. NowgetHasUnsavedChangesreturnstruebecausestartReadingRef !== initialStartReadingRef, triggering the discard modal.What changes do you think we should make in order to solve the problem?
Make
clearOdometerDraftTransactionStatereturnPromise.allof its Onyx operations, andawaitit inuseRestartOnOdometerImagesFailurebefore callingnavigateToStartMoneyRequestStep. This ensures the draft transaction state is fully cleared before the odometer component re-mounts, so the initial refs and current refs will both be empty — no false dirty state.What alternative solutions did you explore? (Optional)
The
awaitapproach is cleanest because it fixes the root cause (navigating before state is cleared) rather than working around the symptom.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.10 remaining items
[-]Odometer-Discard changes modal is shown after refreshing the browser and navigating away[/-][+][Due for payment 2026-05-11] Odometer-Discard changes modal is shown after refreshing the browser and navigating away[/+]melvin-bot commentedon May 4, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon May 4, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.65-6 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-11. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon May 4, 2026
@DylanDylann 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]
arosiclair commentedon May 4, 2026
I believe this is done