Skip to content

[HOLD for payment 2024-10-25] [$250] QAB - Destination opens in the background when starting QAB flow #46352

Description

@lanitochka17

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.0.13-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch New Expensify app
  2. Go to workspace chat
  3. Submit an expense
  4. Return to LHN
  5. Tap FAB
  6. Tap Submit expense under QAB section
  7. Tap app back button

Expected Result:

App will return to LHN after closing QAB flow

Actual Result:

App will return to workspace chat (destination) after closing QAB flow
The destination (in this case, workspace chat) opens in the background when starting QAB flow

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6554078_1722025287007.ScreenRecording_07-27-2024_04-17-08_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01234964a7fed98878
  • Upwork Job ID: 1819145506544874650
  • Last Price Increase: 2024-09-26
  • Automatic offers:
    • tsa321 | Contributor | 104236266
Issue OwnerCurrent Issue Owner: @aimane-chnaif

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 27, 2024
  2. melvin-bot commented on Jul 27, 2024

    @melvin-bot

    Triggered auto assignment to @kevinksullivan (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. lanitochka17 commented on Jul 27, 2024

    @lanitochka17
    Author

    @kevinksullivan FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  4. lanitochka17 commented on Jul 27, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #wave-collect - Release 1

  5. tsa321 commented on Jul 28, 2024

    @tsa321
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-09 22:16:08 UTC.

    Proposal

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

    QAB - Destination opens in the background when starting QAB flow

    What is the root cause of that problem?

    Here:

    if (rhpNavigator) {
    // Routes
    // - matching bottom tab
    // - matching root route for rhp
    // - found rhp
    // This one will be defined because rhpNavigator is defined.
    const focusedRHPRoute = findFocusedRoute(state);
    const routes = [];
    if (focusedRHPRoute) {
    let matchingRootRoute = getMatchingRootRouteForRHPRoute(focusedRHPRoute);
    const isRHPScreenOpenedFromLHN = focusedRHPRoute?.name && RHP_SCREENS_OPENED_FROM_LHN.includes(focusedRHPRoute?.name as RHPScreenOpenedFromLHN);
    // This may happen if this RHP doens't have a route that should be under the overlay defined.
    if (!matchingRootRoute || isRHPScreenOpenedFromLHN) {
    metainfo.isCentralPaneAndBottomTabMandatory = false;
    metainfo.isFullScreenNavigatorMandatory = false;
    // If matchingRootRoute is undefined and it's a narrow layout, don't add a report screen under the RHP.
    matchingRootRoute = matchingRootRoute ?? (!isNarrowLayout ? {name: SCREENS.REPORT} : undefined);
    }

    When the target navigation is RHP from the bottom tab navigator (LHN), as in the case of creating an IOU request, the isRHPScreenOpenedFromLHN does not include SCREENS.MONEY_REQUEST.CREATE. As a result, the isRHPScreenOpenedFromLHN condition evaluates to false, and since there is a matchingRootRoute, the metainfo values for isCentralPaneAndBottomTabMandatory and isFullScreenNavigatorMandatory remain true. Consequently, the navigation state adapts to include the central pane route (the matching root route, which in this case is the report screen).

    If the user clicks on the FAB and selects "Submit Expense," the matchingRootRoute will be undefined because the report ID in the URL/route is generated optimistically. This change will update the metainfo to:
    metainfo.isCentralPaneAndBottomTabMandatory = false; metainfo.isFullScreenNavigatorMandatory = false;

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

    we should include the iou request create focused route, (in this case "manual") add SCREENS.MONEY_REQUEST.CREATE.MANUAL / CONST.TAB_REQUEST_MANUAL in RHP_SCREENS_OPENED_FROM_LHN, also we must check other related screens that can be opened from LHN, the scan and distance tab_request, etc...

    Alternative solution

    I think there will be many screens to include as well.

    I believe a better fix is:

    if (focusedRHPRoute) {
    let matchingRootRoute = getMatchingRootRouteForRHPRoute(focusedRHPRoute);
    const isRHPScreenOpenedFromLHN = focusedRHPRoute?.name && RHP_SCREENS_OPENED_FROM_LHN.includes(focusedRHPRoute?.name as RHPScreenOpenedFromLHN);
    // This may happen if this RHP doens't have a route that should be under the overlay defined.
    if (!matchingRootRoute || isRHPScreenOpenedFromLHN) {

    to make the matchingRootRoute has correct value.

    The getMatchingRootRouteForRHPRoute will always include the report screen if there is a reportID parameter in the route:

    // check for valid reportID in the route params
    // if the reportID is valid, we should navigate back to screen report in CPN
    const reportID = (route.params as Record<string, string | undefined>)?.reportID;
    if (ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]) {
    return {name: SCREENS.REPORT, params: {reportID}};
    }

    However, the route that must include the report screen is the route that starts with /r/. Other routes do not need to include the report screen. Therefore, the code changes should be:

    // sometimes route path start with `/` and sometimes not. just to make sure here.
    if (route?.path.indexOf('/r/') === 0 || route?.path.indexOf('r/') === 0) {
            const reportID = (route.params as Record < string, string | undefined > )?.reportID;
            if (!!reportID && ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]) {
                return {name: SCREENS.REPORT, params: {reportID}};
            }
        }

    Other routes which really require report of reportID param to be openened first can be included in exception list.

  6. melvin-bot commented on Jul 30, 2024

    @melvin-bot

    @kevinksullivan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  7. melvin-bot commented on Aug 1, 2024

    @melvin-bot

    @kevinksullivan Eep! 4 days overdue now. Issues have feelings too...

  8. kevinksullivan commented on Aug 1, 2024

    @kevinksullivan
    Contributor

    Reproduced. I think this is a polish item for collect.

  9. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 1, 2024
  10. changed the title [-]QAB - Destination opens in the background when starting QAB flow[/-] [+][$250] QAB - Destination opens in the background when starting QAB flow[/+] on Aug 1, 2024
  11. 103 remaining items

  12. melvin-bot commented on Oct 18, 2024

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  13. melvin-bot commented on Oct 18, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.50-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2024-10-25. 🎊

    For reference, here are some details about the assignees on this issue:

  14. melvin-bot commented on Oct 18, 2024

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@aimane-chnaif] The PR that introduced the bug has been identified. Link to the PR:
    • [@aimane-chnaif] 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:
    • [@aimane-chnaif] A discussion in #expensify-bugs 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:
    • [@aimane-chnaif] Determine if we should create a regression test for this bug.
    • [@aimane-chnaif] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@sonialiap] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/439489
  15. sonialiap commented on Oct 25, 2024

    @sonialiap
    Contributor

    Payment summary:

  16. aimane-chnaif commented on Oct 28, 2024

    @aimane-chnaif
    Contributor

    Regression Test Proposal

    1. Complete the manual expense submission flow.
    2. Click on FAB, then select QAB to open the expense submission flow.
    3. Click the back button in the header.
    4. For small screens (Android and iOS), verify that the LHN screen opens instead of the report screen. For wide screens, ensure that the submit expense flow functions properly.
    5. Repeat steps 1–4 for the scan and distance expense submission flows.
  17. aimane-chnaif commented on Oct 28, 2024

    @aimane-chnaif
    Contributor

    @sonialiap I am still using upwork

  18. sonialiap commented on Oct 28, 2024

    @sonialiap
    Contributor

    @aimane-chnaif oh sorry! I saw that you're whitelisted for ND payments. Offer sent in Upwork

  19. melvin-bot commented on Oct 29, 2024

    @melvin-bot

    @dangrous @sonialiap Be sure to fill out the Contact List!

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