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
[READY FOR PAYMENT][$500] Implement closing the modal with resetting the browser history #78338
🚨 Edited by proposal-police: This proposal was edited at 2025-12-29 23:43:01 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When reviewing duplicate expenses and deleting one of them, the browser's forward button still allows navigating to the deleted expense page.
What is the root cause of that problem?
The issue is in how navigation is handled after deleting an expense from the Review Duplicates flow. When the user deletes an expense, the app calls onBackButtonPress() which internally uses Navigation.goBack(backTo). This navigates back to the Review Duplicates page but does not clear the browser's forward history.
The Problem Flow:
User is on Review Duplicates page (entry A in browser history)
User clicks on an expense preview → navigation pushes new entry (entry B) - history: [A, B]
User deletes the expense → onBackButtonPress() is called
Navigation.goBack(backTo) navigates back to A
Browser's forward history still contains entry B (the deleted expense page)
Clicking forward button navigates to the deleted expense page
// Lines 538-569 - Current implementationonConfirm={()=>{setIsDeleteModalVisible(false);// ... deletion logic ...onBackButtonPress();// <-- Uses goBack which doesn't clear forward history}}
The onBackButtonPress function (defined in ReportScreen.tsx) uses Navigation.goBack(backTo):
// Lines 391-394 in ReportScreen.tsxif(prioritizeBackTo&&backTo){Navigation.goBack(backToasRoute);// <-- Doesn't clear forward historyreturn;}
Why goBack doesn't work:
Navigation.goBack(route) internally uses goUp() which either:
Pops back to the route if found in current state, OR
Replaces the current route
In either case, the browser's forward history stack is not cleared. The browser's history API maintains its own forward/back stack independent of React Navigation's state.
What changes do you think we should make in order to solve the problem?
When deleting an expense from the Review Duplicates flow, use Navigation.navigate(backTo, {forceReplace: true}) instead of onBackButtonPress(). The forceReplace option tells the navigation to use history.replaceState() instead of history.pushState(), which clears the browser's forward history.
changed the title [-]Implement closing the modal with resetting the browser history[/-][+][$250] Implement closing the modal with resetting the browser history[/+]on Dec 23, 2025
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: I couldn't find a single PR that "missed" this case — the concept of isDeletedTransactionThread simply never existed before the fix.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Tests
Test 1: Basic duplicate delete + forward button (online)
Go to a workspace chat
Create two expenses with the same amount (e.g., $10.00 each)
Open the expense report
Click "Review duplicates" in the header
Click on the first expense preview to open it
Click More → Delete → confirm deletion
You should be navigated back to the single expense view page
Click the browser forward button once
✅ Expected: "Not Found" page (NOT the deleted expense)
Click the browser forward button again (if possible)
✅ Expected: Still "Not Found" or no navigation
Test 2: Basic duplicate delete + forward button (offline)
Repeat steps 1-6 from Test 1
Turn off network (airplane mode / disconnect)
Click the browser forward button once
✅ Expected: "Not Found" page
Click the browser forward button again
✅ Expected: "Not Found" page
Turn network back on
✅ Expected: Page remains "Not Found", no errors in console
Test 3: No brief "Not Found" flash during deletion
Repeat steps 1-6 from Test 1
Watch the screen carefully during step 6 (the delete action)
✅ Expected: No brief flash of "Not Found" page before navigating back. Should see smooth transition (possibly a loading skeleton, then the Review page).
🟡 Regression Tests — Existing Deletion Flows
Test 4: Delete single expense from ReportDetailsPage (existing flow)
Go to a chat and create a single expense
Open the expense
Click the report details (header/3-dot menu)
Delete the expense from the details page
✅ Expected: Navigates back smoothly, no "Not Found" flash, no errors
Click the browser forward button
✅ Expected: "Not Found" page (same behavior as staging/main)
Test 5: Delete expense from MoneyRequestHeader (transaction thread)
Open a chat with a single expense
Click on the expense to open the transaction thread
Click More → Delete → confirm
✅ Expected: Smooth navigation back, no "Not Found" flash
Click the browser forward button
✅ Expected: "Not Found" page
Test 6: Delete expense from MoneyReportHeader (expense report with multiple transactions)
Create a workspace with 3+ expenses in a report
Open the expense report
Open one of the individual expenses
Click More → Delete → confirm
✅ Expected: Navigates back to the expense report (now with fewer transactions), no flash
Check the expense report displays correctly
Test 7: Delete last transaction on a report from search
Open Search, find an expense report with a single transaction
Click on the report to open it in the RHP
Delete the transaction
✅ Expected: Should navigate back or show "Not Found" cleanly — no infinite loading spinner
Click the browser forward button
✅ Expected: "Not Found" page
Test 8: Delete from expense report with multiple transactions from search
Open Search, find an expense report with 2+ transactions
Open the report in the RHP
Delete one transaction
✅ Expected: Report updates to show remaining transactions, no flash
Check that the remaining transaction(s) display correctly
Test 9: Navigate away from Review Duplicates WITHOUT deleting
Activity
melvin-bot commentedon Dec 23, 2025
Triggered auto assignment to @sakluger (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.abbasifaizan70 commentedon Dec 23, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-12-29 23:43:01 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When reviewing duplicate expenses and deleting one of them, the browser's forward button still allows navigating to the deleted expense page.
What is the root cause of that problem?
The issue is in how navigation is handled after deleting an expense from the Review Duplicates flow. When the user deletes an expense, the app calls
onBackButtonPress()which internally usesNavigation.goBack(backTo). This navigates back to the Review Duplicates page but does not clear the browser's forward history.The Problem Flow:
[A, B]onBackButtonPress()is calledNavigation.goBack(backTo)navigates back to ARoot Cause Location:
In
App/src/components/MoneyRequestHeader.tsx, the delete confirmation handler callsonBackButtonPress()without any special handling for the duplicate review flow:The
onBackButtonPressfunction (defined inReportScreen.tsx) usesNavigation.goBack(backTo):Why
goBackdoesn't work:Navigation.goBack(route)internally usesgoUp()which either:In either case, the browser's forward history stack is not cleared. The browser's history API maintains its own forward/back stack independent of React Navigation's state.
What changes do you think we should make in order to solve the problem?
When deleting an expense from the Review Duplicates flow, use
Navigation.navigate(backTo, {forceReplace: true})instead ofonBackButtonPress(). TheforceReplaceoption tells the navigation to usehistory.replaceState()instead ofhistory.pushState(), which clears the browser's forward history.File:
App/src/components/MoneyRequestHeader.tsxChange:
onConfirm={() => { setIsDeleteModalVisible(false); if (!parentReportAction || !transaction) { throw new Error('Data missing'); } if (isTrackExpenseAction(parentReportAction)) { deleteTrackExpense({ chatReportID: report?.parentReportID, chatReport: parentReport, transactionID: transaction.transactionID, reportAction: parentReportAction, iouReport, chatIOUReport, transactions: duplicateTransactions, violations: duplicateTransactionViolations, isSingleTransactionView: true, isChatReportArchived: isParentReportArchived, isChatIOUReportArchived, }); } else { deleteTransactions([transaction.transactionID], duplicateTransactions, duplicateTransactionViolations, currentSearchHash, true); removeTransaction(transaction.transactionID); } + // When coming from the Review Duplicates flow, use navigate with forceReplace + // to clear the browser's forward history. This prevents navigating back to the + // deleted expense page using the browser forward button. + if (isFromReviewDuplicates && route.params.backTo) { + Navigation.navigate(route.params.backTo, {forceReplace: true}); + return; + } onBackButtonPress(); }}Demo
Screen.Recording.2025-12-30.at.4.41.48.AM.mov
[-]Implement closing the modal with resetting the browser history[/-][+][$250] Implement closing the modal with resetting the browser history[/+]melvin-bot commentedon Dec 23, 2025
Job added to Upwork: https://www.upwork.com/jobs/~022003522877557734290
melvin-bot commentedon Dec 23, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Krishna2323 (
External)melvin-bot commentedon Dec 27, 2025
@Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Krishna2323 commentedon Dec 29, 2025
Reviewing...
52 remaining items
melvin-bot commentedon Mar 20, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)mallenexpensify commentedon Mar 20, 2026
@marufsharifi paid, summary updated above.
thx!
@Krishna2323 plz complete the BZ checklist and tag me in a post once you have. Thx
melvin-bot commentedon Mar 20, 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.
Krishna2323 commentedon Mar 23, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: I couldn't find a single PR that "missed" this case — the concept of
isDeletedTransactionThreadsimply never existed before the fix.[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/615232
Regression Test Proposal
Precondition:
Test:
Tests
Test 1: Basic duplicate delete + forward button (online)
Test 2: Basic duplicate delete + forward button (offline)
Test 3: No brief "Not Found" flash during deletion
Test 4: Delete single expense from ReportDetailsPage (existing flow)
Test 5: Delete expense from MoneyRequestHeader (transaction thread)
Test 6: Delete expense from MoneyReportHeader (expense report with multiple transactions)
Test 7: Delete last transaction on a report from search
Test 8: Delete from expense report with multiple transactions from search
Test 9: Navigate away from Review Duplicates WITHOUT deleting
Test 10: "Keep All" on Review Duplicates
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-6f15-a53a-4d9f-008c050caf34Krishna2323 commentedon Mar 23, 2026
@mallenexpensify checklist done ^
mallenexpensify commentedon Mar 24, 2026
Thanks @Krishna2323 , we're good to close!
m-natarajan commentedon Mar 30, 2026
@Krishna2323
User not redirected to "Review duplicates" page after deleting the expenses (Test 1, step-7), Can you please update the steps if required
Recording.2616.mp4
Krishna2323 commentedon Apr 4, 2026
Requested in ND.
Krishna2323 commentedon Apr 4, 2026
@m-natarajan sorry for that. Updated.
twisterdotcom commentedon Apr 5, 2026
@Krishna2323 has submitted payment for this report on ND here.
SO: https://stackoverflowteams.com/c/expensify/questions/7582
Zapier Logs
Run ID: 00040eee-8d66-ae13-94ac-95b3c4436234quinthar commentedon Apr 13, 2026
Approved $500 to @Krishna2323