Skip to content

[Due for payment 2026-07-23] Expense - "Discard Changes" modal not displayed after editing waypoints in distance expense. #94910

Closed

Description

@applause-bot

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.4.24-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: #93268
Email or phone of affected tester (no customers): ibellicotest+2766@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Money Requests

Action Performed:

  1. Open the staging.new.expensify.com website.
  2. Click on FAB > "Track Distance" > "Map"
  3. Enter waypoints.
  4. Click on tab´s back button or browser´s back button.
  5. Note that "Discard Changes" modal is displayed.
  6. Dismiss modal and click on "Next"
  7. On confirm page, click on "Distance" field.
  8. Edit any waypoint.
  9. Click on tab´s back button or browser´s back button.
  10. Note that you return to confirm details page and changes are automatically discarded.

Expected Result:

"Discard Changes" modal should be displayed when clicking on back button after editing waypoints on a distance expense.

Actual Result:

"Discard Changes" modal is not displayed after editing waypoints on a distance expense and clicking on back button. User is redirected to previous page and changes are automatically discarded.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7194795_1782768321834.Track_Modal.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7194795

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. applause-bot commented on Jun 29, 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/bf458e476d1aef3baaadf5592f3c7a26322a5e945cf5ac39e0f9096442cbcbdd

  2. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 29, 2026
  3. melvin-bot commented on Jun 29, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jun 29, 2026

    @melvin-bot

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

  5. github-actions commented on Jun 29, 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 Jun 29, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The "Discard changes" modal does not appear when you edit a waypoint from the confirmation page of a distance expense (via the Distance field) and press back. The waypoint edit is silently discarded with no warning. The modal does correctly appear when entering waypoints during the initial create flow.

    What is the root cause of that problem?

    PR #93268 registered the discard guard with a dirty‑check that is hard‑gated on isCreatingNewRequest:

    IOURequestStepDistance.tsx:159-161

    const {notifySaving} = useDiscardChangesConfirmation({
        getHasUnsavedChanges: () => isCreatingNewRequest && doesMoneyRequestDraftHaveUserInput(transaction),
    });

    isCreatingNewRequest is false whenever a backTo param is present — IOURequestStepDistance.tsx:152:

    const isCreatingNewRequest = !(backTo || isEditing);

    When you open the distance step from the confirmation page's Distance field, it always passes Navigation.getActiveRoute() as backTo — DistanceField.tsx:70. So isCreatingNewRequest becomes false, getHasUnsavedChanges() always returns false, the guard never calls preventDefault, and back navigation proceeds without the modal.

    Why the create flow works but the edit‑from‑confirm flow doesn't
    • Create flow: no backTo, action !== EDIT → isCreatingNewRequest = true → doesMoneyRequestDraftHaveUserInput(transaction) runs and the modal fires.
    • Edit‑from‑confirm flow: backTo is set → isCreatingNewRequest = false → dirty‑check short‑circuits to false → no modal, changes discarded.
    • Note this entry point does not render in isEditing mode (action is still create/submit, not EDIT); the isEditing branch is for the report‑thread edit entry. So the only thing disabling the guard here is the isCreatingNewRequest gate.
    • doesMoneyRequestDraftHaveUserInput (TransactionUtils/index.ts:1256-1262) only counts draft waypoints; it does not diff against a saved baseline, which is why it isn't suitable for the edit case as‑is.

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

    Make getHasUnsavedChanges cover the edit‑from‑confirm entry point instead of being unconditionally disabled by isCreatingNewRequest. When backTo is set (editing an in‑progress request from confirm), "dirty" should be a comparison of the current draft waypoints against the pre‑edit baseline, reusing the change‑detection already present in submitWaypoints — haveWaypointAddressesChanged(transactionBackup?.comment?.waypoints, waypoints) (IOURequestStepDistance.tsx:464-466).

    Roughly:

    getHasUnsavedChanges: () =>
        isCreatingNewRequest
            ? doesMoneyRequestDraftHaveUserInput(transaction)
            : haveWaypointAddressesChanged(transactionBackup?.comment?.waypoints, waypoints),

    (Excluding the isEditing report‑thread entry if that path is intentionally handled elsewhere.)

    What alternative solutions did you explore?

    Reverting PR #93268 would remove the regression but also remove the new (working) back‑button discard guard for the create flow, so a targeted fix to the dirty‑check is preferred.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/94910) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  7. TaduJR commented on Jun 29, 2026

    @TaduJR
    Contributor

    👋

  8. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Jun 30, 2026
  9. 10 remaining items

  10. changed the title [-]Expense - "Discard Changes" modal not displayed after editing waypoints in distance expense.[/-] [+][Due for payment 2026-07-23] Expense - "Discard Changes" modal not displayed after editing waypoints in distance expense.[/+] on Jul 16, 2026
  11. melvin-bot commented on Jul 16, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.34-14 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-07-23. 🎊

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

    • @TaduJR requires payment (Needs manual offer from BZ)
  12. melvin-bot commented on Jul 16, 2026

    @melvin-bot

    @MonilBhavsar @TaduJR 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]. If no checklist is needed for this issue, you can click: [no checklist button]

  13. melvin-bot commented on Jul 21, 2026

    @melvin-bot

    @TaduJR Eep! 4 days overdue now. Issues have feelings too...

  14. melvin-bot commented on Jul 22, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. melvin-bot commented on Jul 22, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    • ROLE: @TaduJR paid $(AMOUNT) via Upwork (LINK)

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. mallenexpensify commented on Jul 24, 2026

    @mallenexpensify
    Contributor

    Assuming this isn't due payment cuz it came from

    Comment if you disagree
    (reminder to cancel upwork job, if not due payment)

  17. TaduJR commented on Jul 24, 2026

    @TaduJR
    Contributor

    We can close this

    cc @MonilBhavsar

  18. MonilBhavsar commented on Jul 24, 2026

    @MonilBhavsar
    Contributor

    Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething 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