Skip to content

[READY FOR PAYMENT ?][$250] Reports - When creating new expense while inside report, user is automatically navigated out #62733

Closed

Description

@nlemma

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.1.51-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): ibellicotest+870@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12 - Chrome / Windows 10 - Chrome
App Component: Search

Action Performed:

  1. Open the staging.new.expensify.com website.
  2. Open any workspace chat.
  3. Create at least two different expenses.
  4. Navigate to "Reports"
  5. Tap on the bookmark icon and select "Reports"
  6. Open the report of the just created expenses.
  7. Tap on the "+" button and select "Create Expense"
  8. Complete the creation flow.
  9. Note that you are automatically navigated out of the report, and land on "Expenses" section again.

Expected Result:

When adding a new expense while inside the report, the user should remain inside of it, and the new expense should be displayed.

Actual Result:

When opening a report on "Reports" and adding a new expense, the user is automatically navigated out of the report and lands on "Expenses" section again.

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

Bug6840761_1748041887616.Out.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021927428430319802299
  • Upwork Job ID: 1927428430319802299
  • Last Price Increase: 2025-05-27
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @miljakljajic

Activity

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

    @melvin-bot

    Triggered auto assignment to @miljakljajic (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. nkdengineer commented on May 24, 2025

    @nkdengineer
    Contributor

    Proposal

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

    When opening a report on "Reports" and adding a new expense, the user is automatically navigated out of the report and lands on "Expenses" section again.

    What is the root cause of that problem?

    It starts happening after this PR, we always reset the search query to default after creating an expense

    App/src/libs/actions/IOU.ts

    Lines 5295 to 5309 in 526a0e4

    if (shouldHandleNavigation) {
    InteractionManager.runAfterInteractions(() => removeDraftTransactions());
    if (!requestMoneyInformation.isRetry) {
    dismissModalAndOpenReportInInboxTab(backToReport ?? activeReportID);
    }
    const trackReport = Navigation.getReportRouteByID(linkedTrackedExpenseReportAction?.childReportID);
    if (trackReport?.key) {
    Navigation.removeScreenByKey(trackReport.key);
    }
    }
    if (activeReportID && (!isMoneyRequestReport || !Permissions.canUseTableReportView(betas))) {
    notifyNewAction(activeReportID, payeeAccountID);
    }

    App/src/libs/actions/IOU.ts

    Lines 816 to 829 in 526a0e4

    function dismissModalAndOpenReportInInboxTab(reportID?: string) {
    const isSearchPageTopmostFullScreenRoute = isSearchTopmostFullScreenRoute();
    if (isSearchPageTopmostFullScreenRoute || !reportID) {
    Navigation.dismissModal();
    if (isSearchPageTopmostFullScreenRoute) {
    const query = buildCannedSearchQuery();
    InteractionManager.runAfterInteractions(() => {
    Navigation.setParams({q: query});
    });
    }
    return;
    }
    Navigation.dismissModalWithReport({reportID});
    }

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

    We should check if we're already on Expense/Reports, we shouldn't reset the search query

    if (isSearchPageTopmostFullScreenRoute) {
        const searchFullScreenRoute = navigationRef.getRootState().routes.findLast((route) => isFullScreenName(route.name));
        const lastRoute = searchFullScreenRoute?.state?.routes?.at(-1);
        if (lastRoute?.name === SCREENS.SEARCH.ROOT) {
            const {q} = lastRoute.params as SearchFullscreenNavigatorParamList[typeof SCREENS.SEARCH.ROOT];
            const queryJSON = buildSearchQueryJSON(q);
            if (queryJSON?.type !== CONST.SEARCH.DATA_TYPES.EXPENSE) {
                const query = buildCannedSearchQuery();
                InteractionManager.runAfterInteractions(() => {
                    Navigation.setParams({q: query});
                });
            }
        }
    }
    

    App/src/libs/actions/IOU.ts

    Lines 816 to 829 in 526a0e4

    function dismissModalAndOpenReportInInboxTab(reportID?: string) {
    const isSearchPageTopmostFullScreenRoute = isSearchTopmostFullScreenRoute();
    if (isSearchPageTopmostFullScreenRoute || !reportID) {
    Navigation.dismissModal();
    if (isSearchPageTopmostFullScreenRoute) {
    const query = buildCannedSearchQuery();
    InteractionManager.runAfterInteractions(() => {
    Navigation.setParams({q: query});
    });
    }
    return;
    }
    Navigation.dismissModalWithReport({reportID});
    }

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

    None

    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. bernhardoj commented on May 24, 2025

    @bernhardoj
    Contributor

    Proposal

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

    When user creating a new expense from report RHP, the report RHP will be closed.

    What is the root cause of that problem?

    After request money, we call dismissModalAndOpenReportInInboxTab. If the topmost full screen is the search screen, then we dismiss the modal.

    App/src/libs/actions/IOU.ts

    Lines 816 to 827 in 526a0e4

    function dismissModalAndOpenReportInInboxTab(reportID?: string) {
    const isSearchPageTopmostFullScreenRoute = isSearchTopmostFullScreenRoute();
    if (isSearchPageTopmostFullScreenRoute || !reportID) {
    Navigation.dismissModal();
    if (isSearchPageTopmostFullScreenRoute) {
    const query = buildCannedSearchQuery();
    InteractionManager.runAfterInteractions(() => {
    Navigation.setParams({q: query});
    });
    }
    return;
    }

    This works fine if we create the money request from FAB. However, if we do it from report RHP, then the report RHP will be dismissed too.

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

    We need to check if we are on report RHP. If true, then we need to only pop the money request flow page.

    const rootState = navigationRef.getRootState();
    if (isReportOpenInRHP(rootState)) {
        const rhpKey = rootState.routes.at(-1)?.state?.key;
        if (rhpKey) {
            Navigation.pop(rhpKey)
        };
        return;
    }

    Navigation.pop is a new function that accepts the key on which the pop action will happen.

    function pop(target: string) {
        navigationRef.current?.dispatch({...StackActions.pop(), target});
    }

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

    N/A

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 27, 2025
  6. changed the title [-]Reports - When creating new expense while inside report, user is automatically navigated out[/-] [+][$250] Reports - When creating new expense while inside report, user is automatically navigated out[/+] on May 27, 2025
  7. melvin-bot commented on May 27, 2025

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

    @melvin-bot

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

  10. self-assigned this
    on May 28, 2025
  11. 54 remaining items

  12. changed the title [-][Due for payment 2025-06-17] [Due for payment 2025-06-16] [Due for payment 2025-06-13] [$250] Reports - When creating new expense while inside report, user is automatically navigated out[/-] [+][$250] Reports - When creating new expense while inside report, user is automatically navigated out[/+] on Jun 17, 2025
  13. dangrous commented on Jun 18, 2025

    @dangrous
    Contributor

    Great, let's move forward at least with the first part, and if you can figure out anything about part two, let us know and we can discuss

  14. bernhardoj commented on Jun 23, 2025

    @bernhardoj
    Contributor

    A new PR is ready

    cc: @fedirjh

  15. miljakljajic commented on Jul 9, 2025

    @miljakljajic
    Contributor

    PR is merged and closed - is this ready for 50% payment now?

  16. dangrous commented on Jul 9, 2025

    @dangrous
    Contributor

    I think so! 7/8 ended the 7-day period. Not sure why the automation didn't trigger, seems like no PRs did that deploy

  17. changed the title [-][$250] Reports - When creating new expense while inside report, user is automatically navigated out[/-] [+][READY FOR PAYMENT ?][$250] Reports - When creating new expense while inside report, user is automatically navigated out[/+] on Jul 11, 2025
  18. miljakljajic commented on Jul 14, 2025

    @miljakljajic
    Contributor

    Upwork Job

    Reviewer: @fedirjh owed $125 via NewDot
    Reviewer: @bernhardoj owed $125 via NewDot

    Ready to request in ND! Updated to 50% original price given the regression.

  19. bernhardoj commented on Jul 14, 2025

    @bernhardoj
    Contributor

    Requested in ND.

  20. JmillsExpensify commented on Jul 14, 2025

    @JmillsExpensify
    Contributor

    $125 approved for @bernhardoj

  21. laurenreidexpensify commented on Aug 6, 2025

    @laurenreidexpensify
    Contributor

    $125 approved in New Expensify for @fedirjh

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.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions