Skip to content

[$250] Expense - Self DM opens instead of transaction thread after merging with unreported expenses #83258

Closed

Description

@mitarachim

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.3.25-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #79766
Email or phone of affected tester (no customers): jsodjsodnjoisjdosij@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Create two expenses.
  4. Open any expense.
  5. Click More > Merge.
  6. Select expense from Step 3 > Continue.
  7. Select all the details from the selected expense in Step 6 (all the second options) > Next.
  8. Click Merge expenses.

Expected Result:

Transaction thread will open (similar to production).

Actual Result:

Self DM opens.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7086422_1771884484694.4.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @thesahindia
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022026068707359737023
  • Upwork Job ID: 2026068707359737023
  • Last Price Increase: 2026-02-23

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Feb 23, 2026
  2. melvin-bot commented on Feb 23, 2026

    @melvin-bot

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

  3. melvin-bot commented on Feb 23, 2026

    @melvin-bot

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

  4. melvin-bot commented on Feb 23, 2026

    @melvin-bot

    Triggered auto assignment to @garrettmknight (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.

  5. github-actions commented on Feb 23, 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. OSBotify commented on Feb 23, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #79766 - "Fix incorrect chat opening after merging expense with self DM" by @marufsharifi (High confidence)
    Related Issues: #78842 (original issue that #79766 was fixing), #79275 (first attempt), #79505 (revert of #79275)

    Recommendation: ROLL FORWARD

    PR #79766 fixed one navigation issue but introduced a regression in a different scenario. The fix is straightforward and localized to the navigation logic. A revert would reintroduce the original bug (#78842), which affects a broader use case.

    Labels: Both DeployBlockerCash and DeployBlocker labels should remain. This is a frontend bug that blocks the App deploy.

    📋 Detailed Analysis

    Evidence

    PR #79766 was merged on 2026-02-23 at 09:03:08Z and is included in staging deployment 9.3.25-0. The issue is reproducible on staging but NOT on production, which confirms the timing.

    The PR modified src/pages/TransactionMerge/ConfirmationPage.tsx to fix a navigation issue where merging a workspace expense with a self DM expense would incorrectly open the workspace chat instead of the self DM.

    However, the fix introduced a regression in a different scenario: when merging two unreported expenses (both in self DM), the navigation now opens the self DM instead of the transaction thread.

    Verification

    The bug is in the navigation logic in src/pages/TransactionMerge/ConfirmationPage.tsx, specifically lines 108-111:

    if (reportIDToDismiss && reportID !== targetTransaction.reportID) {
        Navigation.dismissModalWithReport({reportID: reportIDToDismiss});
        return;
    }

    When merging two self DM expenses:

    1. Both transactions have reportID = CONST.REPORT.UNREPORTED_REPORT_ID
    2. Line 74 converts mergeTransaction.reportID to the actual self DM report ID
    3. reportIDToDismiss becomes the self DM report ID (line 95)
    4. The condition reportID !== targetTransaction.reportID evaluates to selfDMReportID !== UNREPORTED_REPORT_ID, which is true
    5. The code dismisses to the self DM instead of checking if it should open the transaction thread

    Root Cause

    The navigation logic prioritizes dismissing to the merge destination report (self DM) without checking if there is a transaction thread that should be opened instead. The variable targetTransactionThreadReportID is calculated on line 60 but is not used in the non-search navigation path (lines 108-111).

    The fix should check if targetTransactionThreadReportID exists and navigate to it when both transactions are unreported expenses.

    Why Roll Forward Instead of Revert

    1. Simpler fix: The issue is a missing condition check in the navigation logic
    2. PR history: This is the third attempt to fix related navigation issues (Fix incorrect chat opening after merging expense with self DM #79275 → [CP Staging] Revert #79275 – "Fix incorrect chat opening after merging expense with self DM " #79505 revert → Fix incorrect chat opening after merging expense with self DM #79766). Reverting would reintroduce bug [Due for payment 2026-03-04] [$250] Expense- Workspace chat opens instead of destination report after merging with self DM expense #78842, which affects workspace-to-self-DM merges
    3. Localized impact: The fix only affects the navigation logic after merging expenses in self DM
  7. OSBotify commented on Feb 23, 2026

    @OSBotify
    Contributor

    Label Recommendation

    Based on the investigation:

    • This is a frontend bug in the App repository (src/pages/TransactionMerge/ConfirmationPage.tsx)
    • The fix requires changes to the App codebase, not backend/API changes
    • The bug is only on staging (not production), confirming it was introduced in this deployment

    Recommended labels:

    • DeployBlockerCash - KEEP (frontend App deploy blocker) ✓
    • DeployBlocker - This typically applies to backend/Web deploys. Since this is purely a frontend navigation issue, this label may not be necessary, but I am leaving it for internal team review.

    @marufsharifi - As the author of PR #79766, you may be best positioned to quickly implement a fix. The issue is in the navigation logic that needs to check for targetTransactionThreadReportID when both transactions are unreported expenses.

  8. OSBotify commented on Feb 23, 2026

    @OSBotify
    Contributor

    Label Update

    I have removed the DeployBlocker label based on the following analysis:

    Why removed:

    Labels retained:

    • DeployBlockerCash - Correctly blocks the App (frontend) deploy until this is resolved

    The fix should be straightforward - modify the navigation logic in src/pages/TransactionMerge/ConfirmationPage.tsx to check for targetTransactionThreadReportID when dismissing after a merge of unreported expenses.

  9. MelvinBot commented on Feb 23, 2026

    @MelvinBot
    Contributor

    Proposal

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

    After merging two unreported expenses in the Self DM, the user is navigated to the Self DM chat instead of the merged transaction thread. This is a regression introduced by PR #79766.

    What is the root cause of that problem?

    PR #79766 changed the reportID computation in src/pages/TransactionMerge/ConfirmationPage.tsx (line 74) to resolve UNREPORTED_REPORT_ID ('0') to the actual Self DM chat report ID via findSelfDMReportID(). This resolution was needed for the mergeTransactionRequest API call, but it unintentionally changed the downstream navigation logic.

    The navigation flow after merge (lines 95-113) now takes a wrong path for unreported Self DM expenses:

    1. reportID is resolved from '0' to the Self DM chat report ID (e.g. '123456')
    2. reportIDToDismiss = '123456' (defined, since '123456' !== '0')
    3. The condition reportIDToDismiss && reportID !== targetTransaction.reportID evaluates to true (since '123456' !== '0')
    4. dismissModalWithReport({reportID: '123456'}) is called, which navigates to the Self DM chat view (r/123456), not the transaction thread

    Before the PR, reportID stayed as '0', so reportIDToDismiss was undefined, and the code fell through to dismissToSuperWideRHP(), which correctly popped the RHP stack back to the expense view.

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

    In src/pages/TransactionMerge/ConfirmationPage.tsx, the non-search navigation path (line 108-111) should navigate to the transaction thread report instead of the parent report, similar to how the search path already prefers targetTransactionThreadReportID (line 97).

    Change line 108-109 from:

    if (reportIDToDismiss && reportID !== targetTransaction.reportID) {
        Navigation.dismissModalWithReport({reportID: reportIDToDismiss});
    

    to use targetTransactionThreadReportID when available:

    if (reportIDToDismiss && reportID !== targetTransaction.reportID) {
        Navigation.dismissModalWithReport({reportID: targetTransactionThreadReportID ?? reportIDToDismiss});
    

    This ensures that after merging unreported Self DM expenses, the user is navigated to the transaction thread (the expected behavior) rather than the Self DM chat room. When targetTransactionThreadReportID is not available, it falls back to reportIDToDismiss to preserve existing behavior for other cases.

    What alternative solutions did you explore? (Optional)

    1. Separate reportID for API vs navigation: Keep the findSelfDMReportID() resolution only for the mergeTransactionRequest call, and use the original mergeTransaction.reportID for navigation decisions. This would restore the old dismissToSuperWideRHP() path but would not address the broader goal of navigating to the correct transaction thread.

    2. Revert the reportID resolution entirely: Simply revert the line 74 change. However, this would re-introduce the original issue that PR Fix incorrect chat opening after merging expense with self DM #79766 was fixing (incorrect chat opening after merging a workspace expense with a Self DM expense).


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  10. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Feb 23, 2026
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 23, 2026
  12. melvin-bot commented on Feb 23, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (External)

  13. changed the title [-]Expense - Self DM opens instead of transaction thread after merging with unreported expenses[/-] [+][$250] Expense - Self DM opens instead of transaction thread after merging with unreported expenses[/+] on Feb 23, 2026
  14. melvin-bot commented on Feb 23, 2026

    @melvin-bot
  15. rojiphil commented on Feb 24, 2026

    @rojiphil
    Contributor

    This doesn't look like a bug as that is what we implemented in #79766 (Test 1) as per this comment
    cc @joekaufmanexpensify @MonilBhavsar

  16. MonilBhavsar commented on Feb 24, 2026

    @MonilBhavsar
    Contributor

    Feature and not a bug

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsHourlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions