Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-06-20] [$500] [Search v1] LHN shows Not found when navigated from global create menu #42995

Closed
6 tasks
luacmartins opened this issue Jun 3, 2024 · 33 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@luacmartins
Copy link
Contributor

luacmartins commented Jun 3, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number:
Reproducible in staging?:
Reproducible in production?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation:

Action Performed:

There are two issues here:

Issue 1

  1. From the Search page, click on a result
  2. Click on the header link
  3. Notice that the LHN shows not found

Issue 2

  1. While viewing the Search page, click on the global create menu
  2. Submit and expese
  3. Notice that the LHN shows not found

Expected Result:

Navigation should work

Actual Result:

LHN shows not found

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015dea8a0a2e4109e9
  • Upwork Job ID: 1797769446176616448
  • Last Price Increase: 2024-06-04
  • Automatic offers:
    • c3024 | Reviewer | 102591587
    • bernhardoj | Contributor | 102591588
Issue OwnerCurrent Issue Owner: @alexpensify
@luacmartins luacmartins added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 3, 2024
@luacmartins luacmartins self-assigned this Jun 3, 2024
@luacmartins
Copy link
Contributor Author

cc @adamgrzybowski can you take a look please?

Copy link

melvin-bot bot commented Jun 3, 2024

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

@luacmartins luacmartins moved this to Release 1.5: XeroCon 2024 (June 12th) in [#whatsnext] #wave-collect Jun 3, 2024
@dragnoir
Copy link
Contributor

dragnoir commented Jun 3, 2024

Proposal

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

Non supported currency turns error

What is the root cause of that problem?

On the Search page, when an expense or any other type of report is submitted, or when the header link in a report is clicked, the action performed is as follows:

Navigation.dismissModal(activeReportID);

The dismissModal function opens the report view but does not change the left view from SearchPageBottomTab to SidebarScreen. The issue lies within the dismissModalWithReport function:

The propblem is within dismissModalWithReport

if (shouldOpenAllWorkspace) {
switchPolicyID(navigationRef, {route: ROUTES.HOME});
} else {
switchPolicyID(navigationRef, {policyID, route: ROUTES.HOME});
}
const action: StackNavigationAction = getActionFromState(reportState, linkingConfig.config);
if (action) {
action.type = 'REPLACE';
navigationRef.dispatch(action);
}

When switchPolicyID is performed, subsequent actions like navigationRef.dispatch(action) are lost in the memory queue.

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

We should change the order and prioritize navigationRef.dispatch(action)

const  action:  StackNavigationAction  =  getActionFromState(reportState, linkingConfig.config);

if (action) {
action.type  =  'REPLACE';
  navigationRef.dispatch(action);
}

if (shouldOpenAllWorkspace) {
  switchPolicyID(navigationRef, {route:  ROUTES.HOME});
} else {
  switchPolicyID(navigationRef, {policyID, route:  ROUTES.HOME});
}

POC video:

20240603_225950.mp4

What alternative solutions did you explore?

@luacmartins luacmartins added the External Added to denote the issue can be worked on by a contributor label Jun 3, 2024
Copy link

melvin-bot bot commented Jun 3, 2024

Job added to Upwork: https://www.upwork.com/jobs/~015dea8a0a2e4109e9

@melvin-bot melvin-bot bot changed the title [Search v1] LHN shows Not found when navigated from global create menu [$250] [Search v1] LHN shows Not found when navigated from global create menu Jun 3, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 3, 2024
Copy link

melvin-bot bot commented Jun 3, 2024

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

@luacmartins
Copy link
Contributor Author

@c3024 @adamgrzybowski let me know what you think of the proposal above

@bernhardoj
Copy link
Contributor

bernhardoj commented Jun 4, 2024

Proposal

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

LHN shows not found when pressing the report parent navigation or submitting an expense from global create while on the search page.

What is the root cause of that problem?

When pressing the parent navigation link, we use goBack with the parent report as the fallback to go to the parent report.

<PressableWithoutFeedback
onPress={() => {
const parentAction = ReportActionsUtils.getReportAction(parentReportID, parentReportActionID ?? '');
const isVisibleAction = ReportActionsUtils.shouldReportActionBeVisible(parentAction, parentAction?.reportActionID ?? '');
// Pop the thread report screen before navigating to the chat report.
Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(parentReportID));
if (isVisibleAction && !isOffline) {
// Pop the chat report screen before navigating to the linked report action.
Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(parentReportID, parentReportActionID));
}

Because the report screen is in RHP and it's the only screen, we navigate with the UP navigation type, which will replace the current screen with the report screen,

if (shouldEnforceFallback || (isFirstRouteInNavigator && fallbackRoute)) {
navigate(fallbackRoute, CONST.NAVIGATION.TYPE.UP);
return;
}

if (type === CONST.NAVIGATION.TYPE.UP) {
action.type = CONST.NAVIGATION.ACTION_TYPE.REPLACE;

but the bottom tab navigator screen isn't changed. The bottom tab navigator screen should be updated if the navigation target is a central pane screen, which is true for our case, however, the UP type case is prioritized as you can see from the if condition below.

if (type === CONST.NAVIGATION.TYPE.UP) {
action.type = CONST.NAVIGATION.ACTION_TYPE.REPLACE;
// If this action is navigating to the report screen and the top most navigator is different from the one we want to navigate - PUSH the new screen to the top of the stack
} else if (action.payload.name === NAVIGATORS.CENTRAL_PANE_NAVIGATOR && (isTargetScreenDifferentThanCurrent || areParamsDifferent)) {
// We need to push a tab if the tab doesn't match the central pane route that we are going to push.
const topmostBottomTabRoute = getTopmostBottomTabRoute(rootState);
const policyIDsFromState = extractPolicyIDsFromState(stateFromPath);
const matchingBottomTabRoute = getMatchingBottomTabRouteForState(stateFromPath, policyID || policyIDsFromState);
const isNewPolicyID =
(topmostBottomTabRoute?.params as Record<string, string | undefined>)?.policyID !== (matchingBottomTabRoute?.params as Record<string, string | undefined>)?.policyID;
if (topmostBottomTabRoute && (topmostBottomTabRoute.name !== matchingBottomTabRoute.name || isNewPolicyID)) {
root.dispatch({
type: CONST.NAVIGATION.ACTION_TYPE.PUSH,
payload: matchingBottomTabRoute,
});
}

Previously, we had a FORCED_UP type which is always prioritized first and then the UP type will be checked after checking the central pane screen,

if (type == FORCED_UP) ...
else if (target == CENTRAL_PANE_NAVIGATOR) ...
else if (type == UP)

but now, the FORCED_UP is removed and replaced with UP in #42335.

For the second issue, after submitting an expense, we call dismissModal.

Navigation.dismissModal(activeReportID);

What it will do is it will replace the current screen with a report screen and also update the bottom tab screen by switchPolicyID.

const shouldOpenAllWorkspace = isEmptyObject(targetReport) ? true : !doesReportBelongToWorkspace(targetReport, policyMemberAccountIDs, policyID);
if (shouldOpenAllWorkspace) {
switchPolicyID(navigationRef, {route: ROUTES.HOME});
} else {
switchPolicyID(navigationRef, {policyID, route: ROUTES.HOME});
}
const action: StackNavigationAction = getActionFromState(reportState, linkingConfig.config);
if (action) {
action.type = 'REPLACE';
navigationRef.dispatch(action);
}

const actionForBottomTabNavigator = getActionForBottomTabNavigator(action, rootState, policyID);
if (!actionForBottomTabNavigator) {
return;
}
root.dispatch(actionForBottomTabNavigator);

The bottom tab screen will be based on the route that we pass, in our case, it's HOME, so it should show the HOME LHN. If we don't pass route, then it will use the currently focused bottom tab screen (this is the newPath that will be explained below). However, there is a logic here that will always set the LHN to be the search bottom tab if we execute the navigation while on the search page, even if we pass a route to navigate to,

const isOpeningSearchFromBottomTab = topmostCentralPaneRoute?.name === SCREENS.SEARCH.CENTRAL_PANE;
if (isOpeningSearchFromBottomTab) {
newPath = ROUTES.SEARCH.getRoute(CONST.TAB_SEARCH.ALL);
}

Previously, we checked whether the newPath is the search bottom or not before setting the LHN to be the search bottom tab.
image

But it's changed in #42335 too because the const is now removed.

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

To fix the 2nd issue, we can use the old approach by adding back the const,

const isOpeningSearchFromBottomTab = newPath.startsWith(CONST.SEARCH_BOTTOM_TAB_URL);

or update isOpeningSearchFromBottomTab condition so it's true only if we don't pass a route.

const isOpeningSearchFromBottomTab = !route && topmostCentralPaneRoute?.name === SCREENS.SEARCH.CENTRAL_PANE;

To fix the 1st issue, we can either:

  1. Add back FORCED_UP and it's logic like before
  2. Copy the bottom tab update logic from this if block,
    } else if (action.payload.name === NAVIGATORS.CENTRAL_PANE_NAVIGATOR && (isTargetScreenDifferentThanCurrent || areParamsDifferent)) {
    // We need to push a tab if the tab doesn't match the central pane route that we are going to push.
    const topmostBottomTabRoute = getTopmostBottomTabRoute(rootState);
    const policyIDsFromState = extractPolicyIDsFromState(stateFromPath);
    const matchingBottomTabRoute = getMatchingBottomTabRouteForState(stateFromPath, policyID || policyIDsFromState);
    const isNewPolicyID =
    (topmostBottomTabRoute?.params as Record<string, string | undefined>)?.policyID !== (matchingBottomTabRoute?.params as Record<string, string | undefined>)?.policyID;
    if (topmostBottomTabRoute && (topmostBottomTabRoute.name !== matchingBottomTabRoute.name || isNewPolicyID)) {
    root.dispatch({
    type: CONST.NAVIGATION.ACTION_TYPE.PUSH,
    payload: matchingBottomTabRoute,
    });
    }

    to the type is UP logic if the target is the central pane screen
if (type === CONST.NAVIGATION.TYPE.UP) {
    if (action.payload.name === NAVIGATORS.CENTRAL_PANE_NAVIGATOR) // bottom tab screen update goes here
    action.type = CONST.NAVIGATION.ACTION_TYPE.REPLACE;
}
  1. Rearrange the if such as the central pane screen condition is prioritized first,
if (target == CENTRAL_PANE_NAVIGATOR) ...
else if (type == UP)

and add another type check in the first if to change the action type.

action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;

if (target == CENTRAL_PANE_NAVIGATOR) {
    ... (bottom tab screen update)

    if (type  === UP) {
        action.type = CONST.NAVIGATION.ACTION_TYPE.REPLACE
    } else {
        action.type = CONST.NAVIGATION.ACTION_TYPE.PUSH;
    }

   ...
} else if (type === UP) ...
  1. Use dismissModal instead of goBack when pressing the parent navigation link while in a search page (or in report RHP), but we also need to pass the reportActionID to dismissModal so it can shows the correct linked message.

@adamgrzybowski
Copy link
Contributor

@bernhardoj Thanks for this great proposal!

For the issue with dismiss modal I personally prefer this solution:
const isOpeningSearchFromBottomTab = !route && topmostCentralPaneRoute?.name === SCREENS.SEARCH.CENTRAL_PANE;. I like the fact that we don't operate on the url but rather on the state.

For the issue in the linkTo file I like the 3rd option. It looks simple and doesn't use FORCED_UP which may be confusing.

@luacmartins
Copy link
Contributor Author

I agree with @bernhardoj's proposal since it covers both nav issues. Let's implement @adamgrzybowski's suggestion though.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 4, 2024
Copy link

melvin-bot bot commented Jun 4, 2024

📣 @c3024 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jun 4, 2024

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@JmillsExpensify
Copy link

@bernhardoj Quick note for visibility: This PR is quite high value, so I'm going to double the value to reflect that. Can you make this your top priority? Thanks!

@JmillsExpensify JmillsExpensify changed the title [$250] [Search v1] LHN shows Not found when navigated from global create menu [$500] [Search v1] LHN shows Not found when navigated from global create menu Jun 4, 2024
Copy link

melvin-bot bot commented Jun 4, 2024

Upwork job price has been updated to $500

@bernhardoj
Copy link
Contributor

@JmillsExpensify hi, it's late for me now, this will be my first thing to work tomorrow.

@JmillsExpensify
Copy link

Thank you for confirming! Sounds good

@alexpensify
Copy link
Contributor

Awesome, looks like this PR is moving forward. Thanks!

@luacmartins
Copy link
Contributor Author

PR is merged.

This comment was marked as resolved.

@alexpensify
Copy link
Contributor

Weekly Update: Waiting for this PR to go to prod

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 11, 2024
@melvin-bot melvin-bot bot changed the title [$500] [Search v1] LHN shows Not found when navigated from global create menu [HOLD for payment 2024-06-18] [$500] [Search v1] LHN shows Not found when navigated from global create menu Jun 11, 2024
Copy link

melvin-bot bot commented Jun 11, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 11, 2024
Copy link

melvin-bot bot commented Jun 11, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.81-11 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-06-18. 🎊

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

Copy link

melvin-bot bot commented Jun 11, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [@c3024] 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:
  • [@c3024] 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:
  • [@c3024] Determine if we should create a regression test for this bug.
  • [@c3024] 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.
  • [@alexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jun 13, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-06-18] [$500] [Search v1] LHN shows Not found when navigated from global create menu [HOLD for payment 2024-06-20] [HOLD for payment 2024-06-18] [$500] [Search v1] LHN shows Not found when navigated from global create menu Jun 13, 2024
Copy link

melvin-bot bot commented Jun 13, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.82-4 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-06-20. 🎊

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

Copy link

melvin-bot bot commented Jun 13, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [@c3024] 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:
  • [@c3024] 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:
  • [@c3024] Determine if we should create a regression test for this bug.
  • [@c3024] 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.
  • [@alexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@awongCM
Copy link

awongCM commented Jun 16, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!

Version Number: Reproducible in staging?: Reproducible in production?: If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Slack conversation:

Action Performed:

There are two issues here:

Issue 1

  1. From the Search page, click on a result
  2. Click on the header link
  3. Notice that the LHN shows not found

Issue 2

  1. While viewing the Search page, click on the global create menu
  2. Submit and expese
  3. Notice that the LHN shows not found

Expected Result:

Navigation should work

Actual Result:

LHN shows not found

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue Owner

Hi - is this issue going to remain open for a while? I'm interested to contribute to the problem statement.

Copy link

melvin-bot bot commented Jun 16, 2024

📣 @awongCM! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@c3024
Copy link
Contributor

c3024 commented Jun 16, 2024

@awongCM

Issues with the External and Help Wanted labels are open to external contributors. So, this issue is no more open for contribution.

You can check the complete guidelines here.

@awongCM
Copy link

awongCM commented Jun 16, 2024

here

Thanks. I'll take a look in my own spare time. Cheers.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 18, 2024
@alexpensify
Copy link
Contributor

Flagging that the payment day is on June 20

@awongCM
Copy link

awongCM commented Jun 19, 2024

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01076ffa2e22c46ed8

Copy link

melvin-bot bot commented Jun 19, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@alexpensify alexpensify changed the title [HOLD for payment 2024-06-20] [HOLD for payment 2024-06-18] [$500] [Search v1] LHN shows Not found when navigated from global create menu [HOLD for payment 2024-06-20] [$500] [Search v1] LHN shows Not found when navigated from global create menu Jun 20, 2024
@alexpensify
Copy link
Contributor

alexpensify commented Jun 20, 2024

Payouts due: 2024-06-20

Upwork job is here.

Closing, everyone here has been paid and I've closed the job in Expensify. I've also manually corrected the amount due in Upwork as a bonus.

@github-project-automation github-project-automation bot moved this from Release 1.5: XeroCon 2024 (June 12th) to Done in [#whatsnext] #wave-collect Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

8 participants