Skip to content

[$250] Chat - After merging expenses, navigating back, leads to chat again. #80306

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.7.0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-3292/folder/13176670/55373587/1143584220?q=merge&issue_type=jira
Email or phone of affected tester (no customers): ibellicotest+2250@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Motorola MotoG60 / Android 12 (Hybrid app)
App Component: Other

Action Performed:

Prerequisite: Account has at least one workspace.

  1. Open the Expensify app.
  2. Open any workspace chat.
  3. Create two manual expenses in two different reports.
  4. Open the report of any of the just created expenses.
  5. Tap on "More" > "Merge"
  6. Select the second expense.
  7. Keep all the details from the seconds expense and confirm the merging action.
  8. Once redirected to chat again, tap on the arrow on the top left corner to return to "Inbox"
  9. Note that you land on chat again.
  10. Tap on the back button again.
  11. Note that now you correctly land on "Inbox"

Expected Result:

When being redirected to chat after merging expenses, back button should redirect to "Inbox".

Actual Result:

When being redirected to chat after merging expenses, back button navigates to chat again.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7056061_1769127394547.Merge_Back.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022015901507255016520
  • Upwork Job ID: 2015901507255016520
  • Last Price Increase: 2026-03-24
Issue OwnerCurrent Issue Owner: @Krishna2323

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 23, 2026
  2. melvin-bot commented on Jan 23, 2026

    @melvin-bot

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

  3. shankys commented on Jan 23, 2026

    @shankys

    Proposal

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

    When a user merges two expenses and is redirected back to a report/chat, the first back press returns to the same chat again instead of Inbox on Android (narrow layout / small screen/mobile). This makes the back stack feel like it has a duplicate chat entry.

    What is the root cause of that problem?

    The merge flow uses Navigation.dismissModalWithReport() after the merge when it needs to open a different report. In ConfirmationPage, this runs when reportID !== targetTransaction.reportID and the code calls Navigation.dismissModalWithReport({reportID: reportIDToDismiss}).
    See:

    // If we're on search, dismiss the modal and stay on search
    if (!isOnSearch && reportIDToDismiss && reportID !== targetTransaction.reportID) {
    // Navigate to search money report screen if we're on Reports
    if (isSearchTopmostFullScreenRoute()) {
    // Close the current modal screen
    Navigation.dismissModal();
    // Ensure the dismiss completes first
    Navigation.setNavigationActionToMicrotaskQueue(() => {
    // Navigate to the money request report in search results
    Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: reportIDToDismiss}));
    });
    } else {
    Navigation.dismissModalWithReport({reportID: reportIDToDismiss});
    }

    On narrow layout (mobile/small‑screen), dismissModalWithReport does not dismiss the modal first; it directly calls navigate(reportRoute, {forceReplace: true}) while the right‑hand modal (RHP) is still the focused screen.
    That replaces the focused modal route rather than the underlying report route, leaving two report/chat entries in history and requiring two back presses.
    See:

    const reportRoute = ROUTES.REPORT_WITH_ID.getRoute(reportID, reportActionID, referrer, backTo);
    if (getIsNarrowLayout()) {
    navigate(reportRoute, {forceReplace: true});
    return;

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

    Make the merge flow dismiss the modal first and then replace the underlying report route once the modal is fully closed. This keeps only one report/chat entry in history.

    Concretely in

    // If we're on search, dismiss the modal and stay on search
    if (!isOnSearch && reportIDToDismiss && reportID !== targetTransaction.reportID) {
    // Navigate to search money report screen if we're on Reports
    if (isSearchTopmostFullScreenRoute()) {
    // Close the current modal screen
    Navigation.dismissModal();
    // Ensure the dismiss completes first
    Navigation.setNavigationActionToMicrotaskQueue(() => {
    // Navigate to the money request report in search results
    Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: reportIDToDismiss}));
    });
    } else {
    Navigation.dismissModalWithReport({reportID: reportIDToDismiss});
    }
    , in the non‑search path (the else block), add a narrow‑layout guard so that narrow layout uses dismissModal + navigate(..., {forceReplace: true}) and wide layout keeps dismissModalWithReport:

    if (getIsNarrowLayout()) {
        Navigation.dismissModal({
            callback: () => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportIDToDismiss), {forceReplace: true}),
        });
    } else {
        Navigation.dismissModalWithReport({reportID: reportIDToDismiss});
    }

    This keeps the change localized to the merge flow, which avoids altering global navigation behavior in other features.
    The modal close callback fires when the RightModalNavigator unmounts (it emits MODAL_EVENTS.CLOSED), which ensures the replacement runs after the modal is dismissed.
    See:

    useEffect(() => () => DeviceEventEmitter.emit(CONST.MODAL_EVENTS.CLOSED), []);

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. truph01 commented on Jan 23, 2026

    @truph01
    Contributor

    Regression from #78966

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 26, 2026
  6. changed the title [-]Chat - After merging expenses, navigating back, leads to chat again.[/-] [+][$250] Chat - After merging expenses, navigating back, leads to chat again.[/+] on Jan 26, 2026
  7. melvin-bot commented on Jan 26, 2026

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 26, 2026
  9. melvin-bot commented on Jan 26, 2026

    @melvin-bot

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

  10. dylanexpensify commented on Jan 26, 2026

    @dylanexpensify
    Contributor

    @marufsharifi please review

  11. 26 remaining items

  12. melvin-bot commented on Mar 9, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  13. melvin-bot commented on Mar 9, 2026

    @melvin-bot

    This issue has not been updated in over 14 days. @dylanexpensify, @Krishna2323 eroding to Weekly issue.

  14. mvtglobally commented on Mar 15, 2026

    @mvtglobally

    Issue not reproducible during KI retests. (Second week)

  15. melvin-bot commented on Mar 16, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  16. melvin-bot commented on Mar 24, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  17. laurenreidexpensify commented on Mar 26, 2026

    @laurenreidexpensify
    Contributor

    Sorry closed by mistake! Although @dylanexpensify can this one be closed?

  18. dylanexpensify commented on Mar 26, 2026

    @dylanexpensify
    Contributor

    Seems not reproducible, so let's close!

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.ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions