Skip to content

[Due for payment 2026-07-23] Expense - Discard changes modal does not appear after proceeding to next page and exiting it #94844

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.22-2
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): jsonidjosjdojdsojojso@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Open FAB > Create expense > Manual.
  3. Enter amount.
  4. Click RHP back button.
    → Discard changes modal appears.
  5. Click Cancel.
  6. Click Next.
  7. Click RHP back button twice.

Expected Result:

Discard changes modal will appear.

Actual Result:

Discard changes modal does not appear after proceeding to next page and exiting the flow.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7194313_1782740578584.1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7194313

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 29, 2026
  2. 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/9a3652bc115a96720d66e998a6d5e75431909090b55292016b533e49d4078c4a

  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

    Problem

    In Create expense → Manual, the "Discard changes" modal fires on the first back press (after typing an amount) but not after you click Next and then back out of the flow — even though the in‑progress expense is still uncommitted. This was introduced by #93268 (the discard‑changes feature, originally #84246).

    Root cause

    The Amount step's "unsaved changes" check compares the typed amount against the live draft transaction, but clicking Next writes the typed amount into that same draft — so on return the two are equal and the check returns false, letting navigation proceed silently.

    • The check: IOURequestStepAmount.tsx:125-130 returns typedAmountInBackendUnits !== transactionAmount || selectedCurrency !== originalCurrency, where transactionAmount is derived from the draft transaction.
    • Clicking Next → handleSubmit → submitAmount → navigateToNextPage → setMoneyRequestAmount merges {amount, currency} into TRANSACTION_DRAFT{transactionID} — the exact key transactionAmount reads back from (MoneyRequest.ts:751-755).
    • So on the way back: typed amount == saved draft amount → getHasUnsavedChanges() is false → useBeforeRemove returns early without preventDefault → flow closes, no modal.

    isSavingRef is not the cause — useFocusEffect resets it to false when the Amount screen re‑focuses on the way back (index.ts:27-31).

    Step-by-step trace
    1. Type amount X → form holds X, draft amount still 0.
    2. Back → X !== 0 → modal shows ✅
    3. Cancel → stay on Amount.
    4. Next → setMoneyRequestAmount persists X into the draft; navigate forward.
    5. Back to Amount → screen re‑focuses, isSavingRef reset to false, transactionAmount now reads X, form still holds X.
    6. Back again → X === X and currency unchanged → getHasUnsavedChanges() is false → no modal, flow closes ❌

    The same shape exists in IOURequestStepHours.tsx:84-86 (Time), which also baselines against the live draft — worth verifying as part of the fix.

    Recommended fix

    Baseline the dirty‑check against the value captured when the screen first mounts, not the live draft that Next mutates. Snapshot the initial transactionAmount/originalCurrency once (e.g. a useRef set on first render) and compare the typed value against that snapshot in getHasUnsavedChanges. A fresh manual create starts at 0/empty, so after typing X the screen stays "dirty" relative to the snapshot even once X has been persisted via Next — restoring the warning on back‑out. (Note the existing useEffect re‑syncing selectedCurrency when returning from confirmation — keep currency comparison consistent with that.)

    Apply the same snapshot approach to the other "local input" steps that baseline against the draft (Time/Hours, Manual distance, Odometer) so they don't regress identically.

    Alternatives considered

    Related issues


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

  7. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Jun 29, 2026
  8. MonilBhavsar commented on Jun 29, 2026

    @MonilBhavsar
    Contributor

    New feature

  9. 12 remaining items

  10. 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)
  11. 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]

  12. melvin-bot commented on Jul 21, 2026

    @melvin-bot

    @TaduJR Huh... This is 4 days overdue. Who can take care of this?

  13. melvin-bot commented on Jul 22, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  14. 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
  15. mallenexpensify commented on Jul 24, 2026

    @mallenexpensify
    Contributor

    @MelvinBot payment-review
    MODE: <closed-no-pr | payment-due>
    JOB_PRICE: 250 # override if the title bounty differs

    Run the C+ payment framework for this issue and post a structured, evidence-cited
    recommendation. Rules:

    • Suggest only — never auto-pay. A human confirms.
    • Every point / adjustment MUST cite a specific comment permalink. No permalink → no point.
    • Round every %→$ result up to the nearest $25: amount = ceil((pct × JOB_PRICE) / 25) × 25.

    If MODE = closed-no-pr:

    1. Run the eligibility gate; if it fails, or the token-saving skip-gate trips
      (<~8 non-bot comments AND no C+ engagement markers, or closed <48h, or spam/invalid),
      return "$0 — skipped" with a one-line reason and STOP.
    2. Bucket the close reason (A/B/C), score the 5 factors 0–10 with permalinks.
    3. Payout = 25% of JOB_PRICE if score ≥ 8, else $0.

    If MODE = payment-due:

    1. Start at 100% of JOB_PRICE.
    2. Decreases: for any regression, read the offending PR + issue and decide if it's
      truly attributable to this author/reviewer. If yes, −50% per verified regression.
      If fault is unclear, DO NOT deduct — flag for human review.
    3. Increases: evaluate the C+ increase framework (multiple PRs, additional fixes,
      scope expansion, core-flow changes, deploy blockers audited, performance,
      test coverage, files touched), each backed by a permalink.

    Output: recommended $ amount, per-line reasoning with permalinks, confidence
    (High/Med/Low), and any manual-review flags.

  16. MelvinBot commented on Jul 24, 2026

    @MelvinBot
    Contributor

    💵 Payment Review — TaduJR (Contributor)

    Recommendation: $0 for this issue · Base JOB_PRICE $250 · Confidence: High

    MODE resolved: payment-due — PR #95076 merged 2026-07-13 and deployed to production in 9.4.34-14. Start 100% ($250), then apply decreases/increases.

    Why $0: This deploy blocker is a regression from the same contributor's own prior PR, so it isn't a separately-payable job — it's self-cleanup of a deploy blocker.

    Per-line reasoning (all evidence-cited)

    Roles

    • Contributor / PR author: TaduJR — #95076 (the only assignee flagged for payment, per the payment summary).
    • C+ reviewer: ShridharGoel (APPROVED); MonilBhavsar (internal) also approved. Reviewer payment is out of scope for this contributor review — flagged below.

    Base: 100% × $250 = $250.

    Decrease — self-introduced regression (−100%, drives to $0):

    Regressions caused by the fix (#95076) — none found:

    Increases — not applicable to a self-regression cleanup. The scope (4 deploy blockers, core-navigation changes, added test coverage) is real work, but it's remediation of the author's own PR, so it doesn't add to the bounty. The payable job is the original feature, not each blocker.

    🚩 Manual-review flags for mallenexpensify

    1. Payment belongs to the original job #84246 ($250), not to each of the four deploy blockers. Confirm whether TaduJR was already paid there, and whether a regression discount applies to that job given fix: Discard changes modal does't show up when going back with the browser back button #93268 produced 4 deploy blockers (BZ checklist: "I have applied any discounts due to bugs/regressions introduced by this PR").
    2. Don't double-pay: [Due for payment 2026-07-23] Expense - Discard changes modal does not appear after proceeding to next page and exiting it #94844, [Due for payment 2026-07-23] Expense - Discard changes modal does not appear when amount is zero #94845, [Due for payment 2026-07-23] Expense - Different behavior of "Discard Changes" when using app´s or device´s back button. #94861, [Due for payment 2026-07-23] Expense - "Discard Changes" modal not displayed after editing waypoints in distance expense. #94910 are all the same PR (fix: Show discard changes modal on browser/device back in money-request flows #95076) fixing the same self-introduced regression — a single reconciliation on [Due for payment 2026-08-27] [$250] Discard changes modal does't show up when going back with the browser back button #84246, not four payouts.
    3. C+ reviewer payment (ShridharGoel) is separate and not assessed here.

    Suggestion only — a human confirms. Rounding rule (ceil to $25) is moot at $0.

  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