Skip to content

[Due for payment 2026-01-12] [$250] Reports - User is redirected to chat after merging expenses on "Reports" #73057

Closed

Description

@jponikarchuk

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.2.34-2
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-1375/41236824/962798590?q=merge&issue_type=jira
Email or phone of affected tester (no customers): ibellicotest+1934@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 / Android 12 / Chrome ( mWeb / Hybrid app) - Windows 11 / Chrome
App Component: Search

Action Performed:

Prerequisite: Account has at least one workspace.

  1. Open the Expensify app.
  2. Open any workspace chat.
  3. Create two manual expenses on two different reports.
  4. Navigate to "Reports"
  5. Open any of the just created expenses.
  6. Tap on "More" and select "Merge"
  7. Keep all the details of the expense that wasn´t opened.
  8. Note that after finishing the merging process, you land on chat instead of returning to "Reports".
  9. Tap on the arrow on the top left corner.
  10. Note that you land on "Inbox" instead of returning to "Reports"

Expected Result:

After merging expenses on "Reports", user should land on the same section.

Actual Result:

After merging expenses on "Reports", user lands on chat instead of returning to the same section. Also, tapping on the back button on chat, leads to "Inbox" instead of returning to "Reports".

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021983654416053240372
  • Upwork Job ID: 1983654416053240372
  • Last Price Increase: 2025-10-29
Issue OwnerCurrent Issue Owner: @heyjennahay

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 21, 2025
  2. melvin-bot commented on Oct 21, 2025

    @melvin-bot

    Triggered auto assignment to @heyjennahay (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. paulnjs commented on Oct 21, 2025

    @paulnjs
    Contributor

    Proposal

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

    After merging expenses on "Reports", user lands on chat instead of returning to the same section. Also, tapping on the back button on chat, leads to "Inbox" instead of returning to "Reports".

    What is the root cause of that problem?

    We always navigate to the report screen after merging expenses.

    Navigation.dismissModalWithReport({reportID: reportIDToDismiss});

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

    If we're on Reports we should navigate to search money report screen instead

    if (isSearchTopmostFullScreenRoute()) {
        Navigation.dismissModal();
        Navigation.setNavigationActionToMicrotaskQueue(() => {
            Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: reportIDToDismiss}));
        });
        return;
    }
    Navigation.dismissModalWithReport({reportID: reportIDToDismiss});
    

    Navigation.dismissModalWithReport({reportID: reportIDToDismiss});

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    undefined

    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. abzokhattab commented on Oct 21, 2025

    @abzokhattab
    Contributor

    Proposal

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

    After merging expenses from the Reports section, users are redirected to chat instead of returning to Reports, and the back button leads to Inbox.

    What is the root cause of that problem?

    • When users merge expenses from the Reports page, the backTo parameter (which contains the route back to Reports) is available in the route params but is not being passed to Navigation.dismissModalWithReport()
    • Without the backTo parameter, the navigation system doesn't know where the user came from, so it defaults to navigating to the chat without the proper navigation context
    • This causes the back button to lead to Inbox instead of returning to Reports

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

    add back to param to dismissModalWithReport here

                Navigation.dismissModalWithReport({reportID: reportIDToDismiss, backTo});

    This ensures the it knows to return to the Reports page after the merge operation completes.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

    NA

  5. ShridharGoel commented on Oct 21, 2025

    @ShridharGoel
    Contributor

    Proposal

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

    After merging two expenses from the Reports section, the app sends the user back to the chat view and then to the Inbox when they press back. We want the flow to return the user to the same Reports section they started from.

    What is the root cause of that problem?

    The confirmation screen simply dismisses the merge modal

    const handleMergeExpenses = useCallback(() => {
    if (!targetTransaction || !mergeTransaction || !sourceTransaction) {
    return;
    }
    const reportID = mergeTransaction.reportID;
    setIsMergingExpenses(true);
    mergeTransactionRequest({mergeTransactionID: transactionID, mergeTransaction, targetTransaction, sourceTransaction, policy, policyTags, policyCategories});
    const reportIDToDismiss = reportID !== CONST.REPORT.UNREPORTED_REPORT_ID ? reportID : targetTransactionThreadReportID;
    if (reportID !== targetTransaction.reportID && reportIDToDismiss) {
    Navigation.dismissModalWithReport({reportID: reportIDToDismiss});
    } else {
    Navigation.dismissModal();
    }
    }, [targetTransaction, mergeTransaction, sourceTransaction, transactionID, targetTransactionThreadReportID, policy, policyTags, policyCategories]);
    if (isLoadingOnyxValue(mergeTransactionMetadata) || !targetTransactionThreadReport?.reportID) {
    return <FullScreenLoadingIndicator />;
    }
    return (
    <ScreenWrapper
    testID={ConfirmationPage.displayName}
    shouldEnableMaxHeight
    includeSafeAreaPaddingBottom
    >
    <FullPageNotFoundView shouldShow={!mergeTransaction && !isMergingExpenses}>
    <HeaderWithBackButton
    title={translate('transactionMerge.confirmationPage.header')}
    onBackButtonPress={() => {
    Navigation.goBack(backTo);

    so navigation falls back to the chat route instead of the section captured in backTo.

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

    • Track the deepest backTo value that the flow carried forward, and navigate to it once the merge is confirmed.
    • Fall back to the existing dismissal logic when no backTo value is present, so other merge entry points keep working.
    function getDeepestBackToRoute(backTo?: string): Route | undefined {
        if (!backTo) {
            return undefined;
        }
    
        let currentRoute = backTo;
        const visitedRoutes = new Set<string>();
    
        while (currentRoute && !visitedRoutes.has(currentRoute)) {
            visitedRoutes.add(currentRoute);
    
            const queryStartIndex = currentRoute.indexOf('?');
    
            if (queryStartIndex === -1) {
                return currentRoute as Route;
            }
    
            const queryString = currentRoute.slice(queryStartIndex + 1);
            const backToParam = queryString
                .split('&')
                .find((param) => param.startsWith('backTo='));
    
            if (!backToParam) {
                return currentRoute as Route;
            }
    
            const [, nestedBackToValue = ''] = backToParam.split('=');
            if (!nestedBackToValue) {
                return currentRoute as Route;
            }
    
            currentRoute = decodeURIComponent(nestedBackToValue);
        }
    
        return currentRoute as Route;
    }
    
    const deepBackToRoute = useMemo(() => getDeepestBackToRoute(backTo), [backTo]);
    
    const handleMergeExpenses = useCallback(() => {
        ....
        mergeTransactionRequest({mergeTransactionID: transactionID, mergeTransaction, targetTransaction, sourceTransaction, policy, policyTags, policyCategories});
    
        if (deepBackToRoute) {
            Navigation.dismissModal();
            Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.navigate(deepBackToRoute, {forceReplace: true}));
            return;
        }
    
       ....
    }, [
        ....
        deepBackToRoute,
    ]);
  6. dmkt9 commented on Oct 21, 2025

    @dmkt9
    Contributor

    Proposal

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

    After merging expenses on "Reports", user lands on chat instead of returning to the same section. Also, tapping on the back button on chat, leads to "Inbox" instead of returning to "Reports".

    What is the root cause of that problem?

    Since the target reportID is different from the current reportID, it will trigger Navigation.dismissModalWithReport to dismiss the modal and navigate to the target report:

    Navigation.dismissModalWithReport({reportID: reportIDToDismiss});

    However, inside Navigation.dismissModalWithReport, it only navigates to ROUTES.REPORT_WITH_ID.

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

    In dismissModalWithReport, we should check whether we're currently on the search screen. If so, navigate to ROUTES.SEARCH_MONEY_REQUEST_REPORT instead.

    const reportRoute = ROUTES.REPORT_WITH_ID.getRoute(reportID, reportActionID, referrer, backTo);

    let reportRoute = ROUTES.REPORT_WITH_ID.getRoute(reportID, reportActionID, referrer, backTo) as Route;
    if (isSearchTopmostFullScreenRoute()) {
        reportRoute = ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID, backTo});
    }
    
  7. melvin-bot commented on Oct 28, 2025

    @melvin-bot

    @heyjennahay 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 29, 2025
  9. melvin-bot commented on Oct 29, 2025

    @melvin-bot
  10. changed the title [-]Reports - User is redirected to chat after merging expenses on "Reports"[/-] [+][$250] Reports - User is redirected to chat after merging expenses on "Reports"[/+] on Oct 29, 2025
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 29, 2025
  12. 49 remaining items

  13. heyjennahay commented on Jan 13, 2026

    @heyjennahay
    Contributor

    Payment summary

  14. heyjennahay commented on Jan 13, 2026

    @heyjennahay
    Contributor

    Also @paulnjs for future reference, can you please keep an eye out for this post for you to action when your proposal is accepted so the offer can be sent from the original job posting in Upwork? #73057 (comment)

  15. paulnjs commented on Jan 13, 2026

    @paulnjs
    Contributor

    @heyjennahay noted that. Thanks for reminding me 🙏

  16. heyjennahay commented on Jan 13, 2026

    @heyjennahay
    Contributor

    Sorry @paulnjs I added the wrong link for the offer. Here it is https://www.upwork.com/nx/wm/offer/110091078

  17. heyjennahay commented on Jan 14, 2026

    @heyjennahay
    Contributor

    @paulnjs paid $250 via Upwork. Confirmed that the contract has been closed.

    Thanks everyone!

  18. paulnjs commented on Jan 14, 2026

    @paulnjs
    Contributor

    Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!

    Hi @heyjennahay, could you please help to check why this is not woking for me even though I applied many jobs before?

  19. heyjennahay commented on Jan 14, 2026

    @heyjennahay
    Contributor

    @paulnjs to clarify, you have clicked on one of the job links like here to get an offer sent to you that way? #73057 (comment)

  20. mallenexpensify commented on Jan 14, 2026

    @mallenexpensify
    Contributor

    👋 Jobs auto-close after one month :/
    My guess is, after this post, you didn't apply @paulnjs , so the job closed.

    I created a new Upwork job here @paulnjs , please apply and tag @heyjennahay and I in a comment here once you have. Thx

  21. paulnjs commented on Jan 15, 2026

    @paulnjs
    Contributor

    @paulnjs to clarify, you have clicked on one of the job links like here to get an offer sent to you that way? #73057 (comment)

    @heyjennahay Yes, many times before on previous issues

    @mallenexpensify For this one, I was already paid by @heyjennahay

    We're all good here, thanks!

  22. mallenexpensify commented on Jan 16, 2026

    @mallenexpensify
    Contributor

    Thanks @paulnjs

  23. melvin-bot commented on Feb 5, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    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.

  24. parasharrajat commented on Mar 19, 2026

    @parasharrajat
    Member

    Payment requested as per #73057 (comment)

  25. twisterdotcom commented on Mar 19, 2026

    @twisterdotcom
    Contributor

    @parasharrajat has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-5d6e-aa92-9d5e-705c9c2db054
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

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

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions