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-07-23] Expense - Discard changes modal does not appear after proceeding to next page and exiting it #94844
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:
Go to staging.new.expensify.com
Open FAB > Create expense > Manual.
Enter amount.
Click RHP back button.
→ Discard changes modal appears.
Click Cancel.
Click Next.
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.
👋 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.
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
Type amount X → form holds X, draft amount still 0.
Back → X !== 0 → modal shows ✅
Cancel → stay on Amount.
Next → setMoneyRequestAmount persists X into the draft; navigate forward.
Back to Amount → screen re‑focuses, isSavingRef reset to false, transactionAmount now reads X, form still holds X.
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
Flow‑level draft check: have the create start page treat "a draft expense has been started" (e.g. isAmountSet on the draft) as unsaved changes, matching the PR's "flow‑level check for draft‑persisted input" pattern. Broader, but risks warning in cases where no data was entered — needs care to match scenario 1 of fix: Discard changes modal does't show up when going back with the browser back button #93268 (plain tab switch should not warn).
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.
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:
@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]
@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:
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.
Bucket the close reason (A/B/C), score the 5 factors 0–10 with permalinks.
Payout = 25% of JOB_PRICE if score ≥ 8, else $0.
If MODE = payment-due:
Start at 100% of JOB_PRICE.
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.
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.
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):
The fix PR #95076 is TaduJR fixing their own four deploy blockers. Expensify does not separately compensate a contributor for fixing regressions/deploy blockers introduced by their own PR — those are resolved under the original contract. Net: $0 for this issue.
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
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").
Activity
applause-bot commentedon Jun 29, 2026
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
melvin-bot commentedon Jun 29, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #93268
melvin-bot commentedon Jun 29, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Jun 29, 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:
MelvinBot commentedon Jun 29, 2026
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.IOURequestStepAmount.tsx:125-130returnstypedAmountInBackendUnits !== transactionAmount || selectedCurrency !== originalCurrency, wheretransactionAmountis derived from the draft transaction.handleSubmit→submitAmount→navigateToNextPage→setMoneyRequestAmountmerges{amount, currency}intoTRANSACTION_DRAFT{transactionID}— the exact keytransactionAmountreads back from (MoneyRequest.ts:751-755).getHasUnsavedChanges()isfalse→useBeforeRemovereturns early withoutpreventDefault→ flow closes, no modal.isSavingRefis not the cause —useFocusEffectresets it tofalsewhen the Amount screen re‑focuses on the way back (index.ts:27-31).Step-by-step trace
X→ form holdsX, draft amount still0.X !== 0→ modal shows ✅setMoneyRequestAmountpersistsXinto the draft; navigate forward.isSavingRefreset tofalse,transactionAmountnow readsX, form still holdsX.X === Xand currency unchanged →getHasUnsavedChanges()isfalse→ 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/originalCurrencyonce (e.g. auseRefset on first render) and compare the typed value against that snapshot ingetHasUnsavedChanges. A fresh manual create starts at0/empty, so after typingXthe screen stays "dirty" relative to the snapshot even onceXhas been persisted via Next — restoring the warning on back‑out. (Note the existinguseEffectre‑syncingselectedCurrencywhen 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
isAmountSeton the draft) as unsaved changes, matching the PR's "flow‑level check for draft‑persisted input" pattern. Broader, but risks warning in cases where no data was entered — needs care to match scenario 1 of fix: Discard changes modal does't show up when going back with the browser back button #93268 (plain tab switch should not warn).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.
MonilBhavsar commentedon Jun 29, 2026
New feature
12 remaining items
melvin-bot commentedon Jul 16, 2026
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:
melvin-bot commentedon Jul 16, 2026
@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]
melvin-bot commentedon Jul 21, 2026
@TaduJR Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Jul 22, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jul 22, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jul 24, 2026
@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:
If MODE = closed-no-pr:
(<~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.
If MODE = payment-due:
truly attributable to this author/reviewer. If yes, −50% per verified regression.
If fault is unclear, DO NOT deduct — flag for human review.
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.
MelvinBot commentedon Jul 24, 2026
💵 Payment Review —
TaduJR(Contributor)Recommendation:
$0for this issue · BaseJOB_PRICE$250 · Confidence: HighMODE 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
TaduJR— #95076 (the only assignee flagged for payment, per the payment summary).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):
TaduJRauthored the feature PR #93268 ("Discard changes modal…", merged 2026-06-29 07:04).TaduJRto this blocker with the note "You have been assigned to this deploy blocker because you recently merged this PR: #93268" — 100% attributable to the author's own PR.TaduJRfixing their own four deploy blockers. Expensify does not separately compensate a contributor for fixing regressions/deploy blockers introduced by their own PR — those are resolved under the original contract. Net: $0 for this issue.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
mallenexpensifyTaduJRwas 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").ShridharGoel) is separate and not assessed here.Suggestion only — a human confirms. Rounding rule (ceil to $25) is moot at $0.
TaduJR commentedon Jul 24, 2026
We can close this
cc @MonilBhavsar
MonilBhavsar commentedon Jul 24, 2026
Thanks 👍