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-08-25] [$250] Incorrect Navigation Context After Merging Expenses (Always Redirects to Unreported View) #89799
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: Reproducible in staging?: Needs Reproduction (Unable to reproduce) Reproducible in production?: Needs reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@garrettmknight Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Note: This must be tested from the Spend tab. The bug is NOT reproducible from the Inbox tab.
Create Expense A on Report 1 (multi-expense report)
Create Expense B on Report 2
Go to the Spend tab → Reports and open Report 1
Open Expense A from the Report 1 view
Tap More → Merge
Merge with Expense B, selecting Report 1 as the destination
Observe post-merge navigation
Expected Result:
User is redirected to the merged expense view with correct background context:
If merged into a report:
Show Report view in the background
If merged into unreported:
Show Spend → Unreported view in the background
Actual Result:
User is redirected to:
Merged expense view
Background always shows:
Spend → Unreported view, regardless of actual location
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Report changed (line 105) — only fires when reportID !== targetTransaction.reportID, i.e. the user picked a different report during merge. Calls dismissModalWithReport to navigate to that report.
Default fallthrough (line 110) — calls dismissToSuperWideRHP(), which simply closes the merge modal without navigating anywhere.
The bug is that the common case — merging expenses where the destination report is the same as the target transaction's report — skips Branch 2 (because reportID === targetTransaction.reportID) and falls through to Branch 3. This just removes the modal, revealing whatever was already in the navigation stack behind it (typically the Unreported/Spend view the user browsed from).
What changes do you think we should make in order to solve the problem?
In ConfirmationPage.tsx, the condition on line 105 should be broadened so that dismissModalWithReport is called whenever there is a valid reportIDToDismiss, not only when the report changed. The fix is to remove the reportID !== targetTransaction.reportID check:
// Before (line 105):
if (reportIDToDismiss && reportID !== targetTransaction.reportID) {
// After:
if (reportIDToDismiss) {
This ensures the user is always navigated to the correct report after merge, whether or not the report changed during the merge flow. The Unreported case (reportIDToDismiss is undefined) still falls through to dismissToSuperWideRHP() as intended.
What alternative solutions did you explore? (Optional)
An alternative would be to add a new navigation call in the default fallthrough (Branch 3) that explicitly navigates to the target transaction's thread report. However, this would duplicate navigation logic unnecessarily — the simpler fix of widening the existing Branch 2 condition covers all non-search, non-unreported cases in one place.
mergeTransaction.reportID equals targetTransaction.reportID → Branch 2 condition is false
Falls through to dismissToSuperWideRHP() → modal closes, revealing whatever background route was there (Unreported view)
Related issue:Expensify/App#86817 — "Not here page appears after merging expenses offline & tapping back button" — may share root cause in the same navigation fallthrough logic.
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 [-]Incorrect Navigation Context After Merging Expenses (Always Redirects to Unreported View)[/-][+][$250] Incorrect Navigation Context After Merging Expenses (Always Redirects to Unreported View)[/+]on May 6, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-06 18:32:22 UTC.
Replaces my earlier proposal. The earlier one-line fix only removed the same-report guard, but verified testing showed that is incomplete: report-origin merges can still be routed through the broad topmost-search check, and dismissModalWithReport() opens the generic r/:reportID report route instead of the expense report RHP route e/:reportID.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After merging expenses, the merged expense can open over the wrong background context. When the selected merge destination is an expense report, the background should be that expense report view. When the destination is Unreported, the background should remain Spend > Expenses > Unreported.
The affected flow is the merge confirmation navigation in handleMergeExpenses():
There are three navigation issues in the confirmation-page exit logic.
First, the search branch does not rely only on the merge flow's explicit isOnSearch route param. The merge routes already preserve that param through the flow:
That helper only pops to an existing wide/super-wide RHP route, or dismisses the modal if none exists; it does not open the selected destination report:
Third, calling dismissModalWithReport() for report destinations is still not enough. dismissModalWithReport() builds ROUTES.REPORT_WITH_ID, which is r/:reportID, while the expected destination surface for this issue is the expense report RHP route e/:reportID:
For search-origin merges, use only the explicit route param isOnSearch. Keep the current behavior of reopening the merged expense in Search RHP with targetTransactionThreadReportID ?? fallbackSearchReportID, but remove isSearchTopmostFullScreenRoute() from this flow.
For report destinations, build the destination background with ROUTES.EXPENSE_REPORT_RHP.getRoute({reportID: destinationReportID}), not dismissModalWithReport(), because the issue expects the expense report surface (e/:reportID) behind the merged expense.
The report-destination branch should then be layout-aware:
If there is no transaction thread report, dismiss/open only the destination expense report.
If the destination is the same report as the target transaction, use Navigation.dismissToPreviousRHP() so the existing RHP stack is reused.
If the destination differs, dismiss to/open the destination expense report, then queue Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: targetTransactionThreadReportID, backTo: expenseReportRoute})) so the merged expense opens over that destination report.
On wide layout, use dismissToPreviousRHP({afterTransition}) and force-replace the destination expense report route to avoid stacking stale RHP routes.
On narrow layout, dismiss the modal and then open the destination expense report.
If the merge destination is Unreported, keep falling through to Navigation.dismissToSuperWideRHP().
Scope boundaries: touch only src/pages/TransactionMerge/ConfirmationPage.tsx in handleMergeExpenses(). No backend/API changes. No changes to mergeTransactionRequest, MergeTransactionUtils, route definitions, or generic navigation helpers. This covers same-report, another-report, search-origin, and Unreported merge destinations.
What alternative solutions did you explore? (Optional)
The earlier one-line fix removed reportID !== targetTransaction.reportID. That fixes only the same-report fallthrough, but it does not prevent report-origin merges from being captured by isSearchTopmostFullScreenRoute(), and it still routes report destinations through dismissModalWithReport() / r/:reportID instead of the expected expense report route e/:reportID.
Abbas Faizan's demo helped confirm the broader direction: split the destination handling, trust the explicit isOnSearch param, and route report destinations to the expense report surface. The implementation above keeps that behavior but scopes it to ConfirmationPage and uses the existing dismissToPreviousRHP / dismissModal transition hooks instead of changing generic navigation helpers.
Please re-state the problem that we are trying to solve in this issue.
When a user merges two duplicate expenses that belong to the same expense report (in a non-search context), the app incorrectly navigates to the unreported expenses view instead of remaining on or returning to the expense report where the merge occurred. The user expects the post-merge navigation to either stay on the expense report (if it was the topmost screen) or navigate back to it, but instead receives an unexpected redirect to the unreported base view.
What is the root cause of that problem?
The bug originates in src/pages/TransactionMerge/ConfirmationPage.tsx in the handleMergeExpenses function at lines 97–110. After merging transactions, the code computes reportIDToDismiss and then checks the condition reportIDToDismiss && reportID !== targetTransaction.reportID before calling dismissModalWithReport.
When both transactions belong to the same expense report (the typical duplicate-merge case), mergeTransaction.reportID equals targetTransaction.reportID, making the guard reportID !== targetTransaction.reportID evaluate to false. This causes the condition to fail and execution falls through to dismissToSuperWideRHP(), which navigates to the super wide RHP base — resolving to the unreported expenses view in non-search contexts rather than the expense report.
The guard was likely intended to only navigate to a different report (cross-report merge), but it accidentally excludes the same-report case, which should also navigate to the report. The working analog in src/libs/Navigation/Navigation.ts at lines 828–831 shows that dismissModalWithReport already handles the already-topmost-report case internally with its own guard (topmostSuperWideRHPReportID === reportID), safely falling back to dismissToSuperWideRHP when needed.
What changes do you think we should make in order to solve the problem?
File:src/pages/TransactionMerge/ConfirmationPage.tsx Function:handleMergeExpenses Edit: Remove the reportID !== targetTransaction.reportID guard from the condition at line ~110. Change the condition from reportIDToDismiss && reportID !== targetTransaction.reportID to simply reportIDToDismiss. This allows same-report merges to call dismissModalWithReport, which internally handles the already-topmost-report case by falling back to dismissToSuperWideRHP when appropriate. No new imports are required.
Exact change:
if (reportIDToDismiss) {
Navigation.dismissModalWithReport({reportID: reportIDToDismiss});
return;
}
Navigation.dismissToSuperWideRHP();
Blast radius: Isolated to the handleMergeExpenses callback within ConfirmationPage. This is an inline callback with a single call site (the Button onPress at line ~150). The fix does not modify dismissModalWithReport; its existing internal guard safely handles the already-topmost-report case, so no adjacent callers are affected.
What alternative solutions did you explore? (Optional)
Alternative: Modify dismissToSuperWideRHP in src/libs/Navigation/Navigation.ts to accept an optional reportID parameter and navigate to that report instead of the super wide RHP base. Rejection reason: Too broad in scope. This would affect every caller across the codebase (17+ callers of dismissModalWithReport and direct callers of dismissToSuperWideRHP), introducing unnecessary risk across unrelated navigation flows. The bug is specific to ConfirmationPage's guard logic, not a deficiency in the navigation helpers themselves.
Please re-state the problem that we are trying to solve in this issue.
After merging expenses into a report, the merged expense opens over the wrong background — it always shows Spend → Unreported instead of the destination report view.
What is the root cause of that problem?
The non-search exit path of handleMergeExpenses ends in dismissToSuperWideRHP():
dismissToSuperWideRHP() does not open the destination report — it only pops the current RHP stack back to a super-wide RHP route that already exists in it:
But the merge flow's modal stack is the MERGE_TRANSACTION stack — it never contains an EXPENSE_REPORT super-wide route. So dismissToModalStack finds nothing (lastFoundModalStackIndex === -1) and degrades to a bare dismissModal(), which just pops the modal and reveals whatever fullscreen route sat underneath — Spend → Unreported:
So the mechanism is not merely that the reportID !== targetTransaction.reportID guard is too narrow — it is that the branch it falls into (dismissToSuperWideRHP) was written assuming the destination report's super-wide RHP is already on the stack, which is never true for a merge launched from another context. The destination report is therefore never opened. Note that even routing same-report merges through dismissModalWithReport is not the full fix: that helper builds ROUTES.REPORT_WITH_ID (r/:reportID, the chat report), not the expense report view (e/:reportID) that the issue's Expected Result calls "Report view":
What changes do you think we should make in order to solve the problem?
For a concrete destination report we should explicitly open the destination expense report (e/:reportID) and reopen the merged-expense thread on top of it, instead of relying on dismissToSuperWideRHP() to find a route that isn't there. In handleMergeExpenses, replace the report branch + fallthrough:
// Concrete destination report: reveal the expense report view, then open the merged expense on topif(reportIDToDismiss){constexpenseReportRoute=ROUTES.EXPENSE_REPORT_RHP.getRoute({reportID: reportIDToDismiss});Navigation.dismissModal({afterTransition: ()=>{Navigation.navigate(expenseReportRoute);if(targetTransactionThreadReportID){Navigation.setNavigationActionToMicrotaskQueue(()=>{Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: targetTransactionThreadReportID,backTo: expenseReportRoute}));});}},});return;}// Only Unreported (no concrete destination report) keeps the existing backgroundNavigation.dismissToSuperWideRHP();
This makes the background the destination expense report view (e/:reportID) and lands the merged expense (the transaction thread) on top, matching both halves of the Expected Result. The Unreported case (reportIDToDismiss === undefined) still falls through to dismissToSuperWideRHP() unchanged.
Note: removing the reportID !== targetTransaction.reportID guard is still required so same-report merges reach this branch instead of falling through — but on its own that guard removal only swaps one wrong background (Unreported) for another (the chat r/:reportID), which is why the branch needs to target EXPENSE_REPORT_RHP rather than dismissModalWithReport.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Cover the three merge destinations in a non-search context: (1) merge into the same report the target expense is already on → background is that expense report view and the merged expense opens on top; (2) merge into a different report → background is the new destination report; (3) merge into Unreported → background stays Spend → Unreported. Assert the topmost full-screen route after merge for each.
What alternative solutions did you explore? (Optional)
A minimal fix is to only widen the guard to if (reportIDToDismiss) and reuse dismissModalWithReport. It fixes the "always Unreported" symptom but lands the user on the chat report (r/:reportID) rather than the expense report view, so it doesn't fully satisfy the Expected Result. The approach above is slightly larger but routes to the correct surface in one place and keeps dismissToSuperWideRHP reserved for the genuine Unreported case.
⚠️@yusufdeveloper2903 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
[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: No regression. The bug existed for long time
[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.
Thanks for laying out the scenarios so clearly. After reviewing, I'm keeping this at the original $250. The scope of the issue stayed the same throughout: correct navigation after merging an expense. The additional cases handled during review were part of making that fix complete rather than new requirements added along the way, so they fall within the original job.
That said, the responsiveness and test coverage here were genuinely appreciated.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
MelvinBot commentedon May 6, 2026
Proposal
What is the root cause of that problem?
The post-merge navigation in
ConfirmationPage.tsx:105-110has three branches:reportID !== targetTransaction.reportID, i.e. the user picked a different report during merge. CallsdismissModalWithReportto navigate to that report.dismissToSuperWideRHP(), which simply closes the merge modal without navigating anywhere.The bug is that the common case — merging expenses where the destination report is the same as the target transaction's report — skips Branch 2 (because
reportID === targetTransaction.reportID) and falls through to Branch 3. This just removes the modal, revealing whatever was already in the navigation stack behind it (typically the Unreported/Spend view the user browsed from).What changes do you think we should make in order to solve the problem?
In
ConfirmationPage.tsx, the condition on line 105 should be broadened so thatdismissModalWithReportis called whenever there is a validreportIDToDismiss, not only when the report changed. The fix is to remove thereportID !== targetTransaction.reportIDcheck:This ensures the user is always navigated to the correct report after merge, whether or not the report changed during the merge flow. The Unreported case (
reportIDToDismissisundefined) still falls through todismissToSuperWideRHP()as intended.What alternative solutions did you explore? (Optional)
An alternative would be to add a new navigation call in the default fallthrough (Branch 3) that explicitly navigates to the target transaction's thread report. However, this would duplicate navigation logic unnecessarily — the simpler fix of widening the existing Branch 2 condition covers all non-search, non-unreported cases in one place.
Investigation details
Evidence chain:
MoneyRequestHeaderSecondaryActions.tsx:338-348)handleMergeExpenses()fires (line 67)mergeTransaction.reportIDequalstargetTransaction.reportID→ Branch 2 condition isfalsedismissToSuperWideRHP()→ modal closes, revealing whatever background route was there (Unreported view)Related issue: Expensify/App#86817 — "Not here page appears after merging expenses offline & tapping back button" — may share root cause in the same navigation fallthrough logic.
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.melvin-bot commentedon May 6, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mkhutornyi (
External)[-]Incorrect Navigation Context After Merging Expenses (Always Redirects to Unreported View)[/-][+][$250] Incorrect Navigation Context After Merging Expenses (Always Redirects to Unreported View)[/+]melvin-bot commentedon May 6, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022052092490808686700
KJ21-ENG commentedon May 6, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-06 18:32:22 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After merging expenses, the merged expense can open over the wrong background context. When the selected merge destination is an expense report, the background should be that expense report view. When the destination is Unreported, the background should remain Spend > Expenses > Unreported.
The affected flow is the merge confirmation navigation in
handleMergeExpenses():App/src/pages/TransactionMerge/ConfirmationPage.tsx
Lines 67 to 110 in fdb50e6
What is the root cause of that problem?
There are three navigation issues in the confirmation-page exit logic.
First, the search branch does not rely only on the merge flow's explicit
isOnSearchroute param. The merge routes already preserve that param through the flow:App/src/ROUTES.ts
Lines 3490 to 3524 in fdb50e6
But
ConfirmationPagealso checksisSearchTopmostFullScreenRoute():App/src/pages/TransactionMerge/ConfirmationPage.tsx
Lines 96 to 103 in fdb50e6
That helper reads the current topmost full-screen route, not where the merge flow was launched from:
App/src/libs/Navigation/helpers/isSearchTopmostFullScreenRoute.ts
Lines 7 to 16 in fdb50e6
So a report-origin merge can be treated as a search-origin merge if Search is the topmost full-screen route underneath the modal stack.
Second, the report branch is gated by
reportID !== targetTransaction.reportID, so same-report merges fall through todismissToSuperWideRHP():App/src/pages/TransactionMerge/ConfirmationPage.tsx
Lines 105 to 110 in fdb50e6
That helper only pops to an existing wide/super-wide RHP route, or dismisses the modal if none exists; it does not open the selected destination report:
App/src/libs/Navigation/Navigation.ts
Lines 943 to 983 in fdb50e6
Third, calling
dismissModalWithReport()for report destinations is still not enough.dismissModalWithReport()buildsROUTES.REPORT_WITH_ID, which isr/:reportID, while the expected destination surface for this issue is the expense report RHP routee/:reportID:App/src/libs/Navigation/Navigation.ts
Lines 824 to 849 in fdb50e6
App/src/ROUTES.ts
Lines 1204 to 1210 in fdb50e6
App/src/ROUTES.ts
Lines 632 to 639 in fdb50e6
What changes do you think we should make in order to solve the problem?
Update
src/pages/TransactionMerge/ConfirmationPage.tsxinsidehandleMergeExpenses().Derive the destination explicitly instead of collapsing report and Unreported destinations into one normalized
reportID:For search-origin merges, use only the explicit route param
isOnSearch. Keep the current behavior of reopening the merged expense in Search RHP withtargetTransactionThreadReportID ?? fallbackSearchReportID, but removeisSearchTopmostFullScreenRoute()from this flow.For report destinations, build the destination background with
ROUTES.EXPENSE_REPORT_RHP.getRoute({reportID: destinationReportID}), notdismissModalWithReport(), because the issue expects the expense report surface (e/:reportID) behind the merged expense.The report-destination branch should then be layout-aware:
Navigation.dismissToPreviousRHP()so the existing RHP stack is reused.Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: targetTransactionThreadReportID, backTo: expenseReportRoute}))so the merged expense opens over that destination report.dismissToPreviousRHP({afterTransition})and force-replace the destination expense report route to avoid stacking stale RHP routes.Navigation.dismissToSuperWideRHP().Scope boundaries: touch only
src/pages/TransactionMerge/ConfirmationPage.tsxinhandleMergeExpenses(). No backend/API changes. No changes tomergeTransactionRequest,MergeTransactionUtils, route definitions, or generic navigation helpers. This covers same-report, another-report, search-origin, and Unreported merge destinations.What alternative solutions did you explore? (Optional)
The earlier one-line fix removed
reportID !== targetTransaction.reportID. That fixes only the same-report fallthrough, but it does not prevent report-origin merges from being captured byisSearchTopmostFullScreenRoute(), and it still routes report destinations throughdismissModalWithReport()/r/:reportIDinstead of the expected expense report routee/:reportID.Abbas Faizan's demo helped confirm the broader direction: split the destination handling, trust the explicit
isOnSearchparam, and route report destinations to the expense report surface. The implementation above keeps that behavior but scopes it toConfirmationPageand uses the existingdismissToPreviousRHP/dismissModaltransition hooks instead of changing generic navigation helpers.aswin-s commentedon May 6, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user merges two duplicate expenses that belong to the same expense report (in a non-search context), the app incorrectly navigates to the unreported expenses view instead of remaining on or returning to the expense report where the merge occurred. The user expects the post-merge navigation to either stay on the expense report (if it was the topmost screen) or navigate back to it, but instead receives an unexpected redirect to the unreported base view.
What is the root cause of that problem?
The bug originates in
src/pages/TransactionMerge/ConfirmationPage.tsxin thehandleMergeExpensesfunction at lines 97–110. After merging transactions, the code computesreportIDToDismissand then checks the conditionreportIDToDismiss && reportID !== targetTransaction.reportIDbefore callingdismissModalWithReport.When both transactions belong to the same expense report (the typical duplicate-merge case),
mergeTransaction.reportIDequalstargetTransaction.reportID, making the guardreportID !== targetTransaction.reportIDevaluate to false. This causes the condition to fail and execution falls through todismissToSuperWideRHP(), which navigates to the super wide RHP base — resolving to the unreported expenses view in non-search contexts rather than the expense report.The guard was likely intended to only navigate to a different report (cross-report merge), but it accidentally excludes the same-report case, which should also navigate to the report. The working analog in
src/libs/Navigation/Navigation.tsat lines 828–831 shows thatdismissModalWithReportalready handles the already-topmost-report case internally with its own guard (topmostSuperWideRHPReportID === reportID), safely falling back todismissToSuperWideRHPwhen needed.App/src/pages/TransactionMerge/ConfirmationPage.tsx
Lines 97 to 110 in 3caeca4
App/src/libs/Navigation/Navigation.ts
Lines 828 to 831 in 3caeca4
What changes do you think we should make in order to solve the problem?
File:
src/pages/TransactionMerge/ConfirmationPage.tsxFunction:
handleMergeExpensesEdit: Remove the
reportID !== targetTransaction.reportIDguard from the condition at line ~110. Change the condition fromreportIDToDismiss && reportID !== targetTransaction.reportIDto simplyreportIDToDismiss. This allows same-report merges to calldismissModalWithReport, which internally handles the already-topmost-report case by falling back todismissToSuperWideRHPwhen appropriate. No new imports are required.Exact change:
Blast radius: Isolated to the
handleMergeExpensescallback withinConfirmationPage. This is an inline callback with a single call site (the ButtononPressat line ~150). The fix does not modifydismissModalWithReport; its existing internal guard safely handles the already-topmost-report case, so no adjacent callers are affected.What alternative solutions did you explore? (Optional)
dismissToSuperWideRHPinsrc/libs/Navigation/Navigation.tsto accept an optionalreportIDparameter and navigate to that report instead of the super wide RHP base.Rejection reason: Too broad in scope. This would affect every caller across the codebase (17+ callers of
dismissModalWithReportand direct callers ofdismissToSuperWideRHP), introducing unnecessary risk across unrelated navigation flows. The bug is specific toConfirmationPage's guard logic, not a deficiency in the navigation helpers themselves.yusufdeveloper2903 commentedon May 6, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
David-2002065 commentedon May 6, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
After merging expenses into a report, the merged expense opens over the wrong background — it always shows Spend → Unreported instead of the destination report view.
What is the root cause of that problem?
The non-search exit path of
handleMergeExpensesends indismissToSuperWideRHP():App/src/pages/TransactionMerge/ConfirmationPage.tsx
Lines 108 to 113 in 103cd4a
dismissToSuperWideRHP()does not open the destination report — it only pops the current RHP stack back to a super-wide RHP route that already exists in it:App/src/libs/Navigation/Navigation.ts
Lines 1005 to 1011 in 103cd4a
The super-wide set is just
SEARCH_MONEY_REQUEST_REPORTandEXPENSE_REPORT:App/src/components/WideRHPContextProvider/WIDE_RIGHT_MODALS.ts
Line 9 in 103cd4a
But the merge flow's modal stack is the
MERGE_TRANSACTIONstack — it never contains anEXPENSE_REPORTsuper-wide route. SodismissToModalStackfinds nothing (lastFoundModalStackIndex === -1) and degrades to a baredismissModal(), which just pops the modal and reveals whatever fullscreen route sat underneath — Spend → Unreported:App/src/libs/Navigation/Navigation.ts
Lines 983 to 989 in 103cd4a
So the mechanism is not merely that the
reportID !== targetTransaction.reportIDguard is too narrow — it is that the branch it falls into (dismissToSuperWideRHP) was written assuming the destination report's super-wide RHP is already on the stack, which is never true for a merge launched from another context. The destination report is therefore never opened. Note that even routing same-report merges throughdismissModalWithReportis not the full fix: that helper buildsROUTES.REPORT_WITH_ID(r/:reportID, the chat report), not the expense report view (e/:reportID) that the issue's Expected Result calls "Report view":App/src/libs/Navigation/Navigation.ts
Lines 875 to 881 in 103cd4a
What changes do you think we should make in order to solve the problem?
For a concrete destination report we should explicitly open the destination expense report (
e/:reportID) and reopen the merged-expense thread on top of it, instead of relying ondismissToSuperWideRHP()to find a route that isn't there. InhandleMergeExpenses, replace the report branch + fallthrough:App/src/pages/TransactionMerge/ConfirmationPage.tsx
Lines 108 to 113 in 103cd4a
This makes the background the destination expense report view (
e/:reportID) and lands the merged expense (the transaction thread) on top, matching both halves of the Expected Result. The Unreported case (reportIDToDismiss === undefined) still falls through todismissToSuperWideRHP()unchanged.Note: removing the
reportID !== targetTransaction.reportIDguard is still required so same-report merges reach this branch instead of falling through — but on its own that guard removal only swaps one wrong background (Unreported) for another (the chatr/:reportID), which is why the branch needs to targetEXPENSE_REPORT_RHPrather thandismissModalWithReport.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Cover the three merge destinations in a non-search context: (1) merge into the same report the target expense is already on → background is that expense report view and the merged expense opens on top; (2) merge into a different report → background is the new destination report; (3) merge into Unreported → background stays Spend → Unreported. Assert the topmost full-screen route after merge for each.
What alternative solutions did you explore? (Optional)
A minimal fix is to only widen the guard to
if (reportIDToDismiss)and reusedismissModalWithReport. It fixes the "always Unreported" symptom but lands the user on the chat report (r/:reportID) rather than the expense report view, so it doesn't fully satisfy the Expected Result. The approach above is slightly larger but routes to the correct surface in one place and keepsdismissToSuperWideRHPreserved for the genuine Unreported case.github-actions commentedon May 6, 2026
15antonian commentedon May 6, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
139 remaining items
mkhutornyi commentedon Aug 21, 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: No regression. The bug existed for long time
[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/675781
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-5028-af4f-e910-bd3954e78d74mkhutornyi commentedon Aug 22, 2026
cc: @grgia
melvin-bot commentedon Aug 24, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Aug 25, 2026
@grgia 👀 above on the proposed price increase, plz
grgia commentedon Aug 28, 2026
Thanks for laying out the scenarios so clearly. After reviewing, I'm keeping this at the original $250. The scope of the issue stayed the same throughout: correct navigation after merging an expense. The additional cases handled during review were part of making that fix complete rather than new requirements added along the way, so they fall within the original job.
That said, the responsiveness and test coverage here were genuinely appreciated.
@mallenexpensify all set to process at $250 for both.
mallenexpensify commentedon Aug 28, 2026
Payment Summary
Contributor: @apeyada paid $250 via Upwork
Contributor+: @mkhutornyi due $250 via NewDot
mkhutornyi commentedon Aug 29, 2026
@mallenexpensify please update username. Thanks
mallenexpensify commentedon Aug 31, 2026
Apologies @mkhutornyi . How you're third on this list ¯_(ツ)_/¯
trjExpensify commentedon Sep 17, 2026
approved $250 for @mkhutornyi