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

[Due for payment 2025-02-27] [$250] Workspace - Inconsistent back navigation when clicking app back button #55196

Open
1 of 8 tasks
mitarachim opened this issue Jan 14, 2025 · 31 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@mitarachim
Copy link

mitarachim commented Jan 14, 2025

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: v9.0.83-5
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
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): [email protected]
Issue reported by: Applause Internal Team
Device used: MacOS Chrome, Desktop
App Component: Other

Action Performed:

  1. Navigate to a workspace chat
  2. Click on header > Go to Workspace
  3. Click on browser back button
  4. Click on Go to Workspace button
  5. Click on app back button next workspace avatar

Expected Result:

User should be navigated back to workspace chat details page the same way as it does for browser back button

Actual Result:

User is navigated back to workspace list page

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6713719_1736841131876.Screen_Recording_2025-01-14_at_10.44.03_in_the_morning.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021879341293709833562
  • Upwork Job ID: 1879341293709833562
  • Last Price Increase: 2025-01-29
  • Automatic offers:
    • daledah | Contributor | 105926587
Issue OwnerCurrent Issue Owner: @maddylewis
@mitarachim mitarachim added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 14, 2025
Copy link

melvin-bot bot commented Jan 14, 2025

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

@daledah
Copy link
Contributor

daledah commented Jan 14, 2025

Proposal

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

Workspace - Inconsistent back navigation when clicking app back button

What is the root cause of that problem?

We are using normal navigate when we click 'go to workspace' button

if (isSmallScreenWidth) {
Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(report?.policyID));
return;
}
Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(report?.policyID));
},

And call dismissModal when clicking back button here

<HeaderWithBackButton
title={policyName}
onBackButtonPress={() => {
if (route.params?.backTo) {
Navigation.resetToHome();
Navigation.isNavigationReady().then(() => Navigation.navigate(route.params?.backTo as Route));
} else {
Navigation.dismissModal();
}
}}

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

We should update type of this navigate to type CONST.NAVIGATION.TYPE.UP to workspace chat this will make sure that we replace the appropriate screen at the root

      action: () => {
          if (!report?.policyID) {
              return;
          }
          if (isSmallScreenWidth) {
              Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(report?.policyID), CONST.NAVIGATION.TYPE.UP );
              return;
          }
          Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(report?.policyID), CONST.NAVIGATION.TYPE.UP );
      },

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)

OR we can add backTo to route WORKSPACE_INITIAL and WORKSPACE_PROFILE and value it with Navigation.getActiveRoute()

if (isSmallScreenWidth) {
Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(report?.policyID));
return;
}
Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(report?.policyID));
},

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.

@huult
Copy link
Contributor

huult commented Jan 14, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-01-16 16:11:04 UTC.

Proposal

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

Inconsistent back navigation when clicking app back button

What is the root cause of that problem?

We did not send backTo when opening the workspace

if (isSmallScreenWidth) {
Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(report?.policyID));
return;
}
Navigation.navigate(ROUTES.WORKSPACE_PROFILE.getRoute(report?.policyID));

So, when we go back from HeaderWithBackButton, it will call Navigation.dismissModal();

Navigation.dismissModal();

The latest route is FULL_SCREEN_NAVIGATOR, and this page is Settings_Workspaces. As a result, the workspace init page is displayed, causing this issue to occur.

const lastRoute = state.routes.at(-1);

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

To fix this issue, we need to check if the navigation goes to FULL_SCREEN_NAVIGATOR, followed by SETTINGS.WORKSPACES, and then SCREENS.REPORT. If so, it indicates that we are on the report details page. With this approach, we don't need to check anything when navigating to the workspace. This is a global fix

Navigation.dismissModal();

Update to:

        const state = navigationRef.current?.getRootState() as State<RootStackParamList>;
        const shouldPopHome =
            state.routes?.length >= 3 &&
            state.routes.at(-1)?.name === NAVIGATORS.FULL_SCREEN_NAVIGATOR &&
            state.routes.at(-2)?.name === SCREENS.SETTINGS.WORKSPACES &&
            state.routes.at(-3)?.name === SCREENS.REPORT &&
            getTopmostBottomTabRoute(state)?.name === SCREENS.SETTINGS.ROOT;

        if (shouldPopHome) {
            Navigation.resetToHome();
            navigationRef.goBack();
            Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(`${currentUserPolicyExpenseChat?.reportID ?? CONST.DEFAULT_NUMBER_ID}`));
        } else {
            Navigation.dismissModal();
        }
POC
Screen.Recording.2025-01-14.at.23.03.58.mp4

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

This is a UI bug and does not require testing.

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.

@maddylewis maddylewis added the External Added to denote the issue can be worked on by a contributor label Jan 15, 2025
@melvin-bot melvin-bot bot changed the title Workspace - Inconsistent back navigation when clicking app back button [$250] Workspace - Inconsistent back navigation when clicking app back button Jan 15, 2025
Copy link

melvin-bot bot commented Jan 15, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 15, 2025
Copy link

melvin-bot bot commented Jan 15, 2025

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

@rojiphil
Copy link
Contributor

Thanks for your proposals.

To fix this issue, we cannot use backTo or TYPE.UP because the issue will still occur if the page is refreshed and then the back button is clicked or go to other tab

@huult What issue will occur on using backTo and after the page is refreshed? Maybe I am missing something here.

we can add backTo to route WORKSPACE_INITIAL and WORKSPACE_PROFILE and value it with Navigation.getActiveRoute()

@daledah Using CONST.NAVIGATION.TYPE.UP does not seem to be the right thing to do and it also do not work for me. But using backTo may work. Can you please demonstrate that backTo works?

I think this is little tricky to solve as it could easily lead to regressions. Can you both please share a test branch based on your proposals to demonstrate that it works? Thanks.

@huult
Copy link
Contributor

huult commented Jan 16, 2025

@rojiphil

If we use my solution, we don’t need to add backTo for each case. It’s safer because there’s no worry about missing a case.

Here is my test branch

Test branch

Here is the POC in my proposal

Screen.Recording.2025-01-14.at.23.03.58.mp4

@huult What issue will occur on using backTo and after the page is refreshed? Maybe I am missing something here.

I updated the proposal to remove this

@daledah
Copy link
Contributor

daledah commented Jan 16, 2025

POC.mov

@rojiphil here is my test branch

We just need to add backTo to the WORKSPACE_PROFILE route because the WORKSPACE_INITIAL route already has backTo before. Adding backTo to a route has been done a lot in App.

Copy link

melvin-bot bot commented Jan 20, 2025

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

@melvin-bot melvin-bot bot added the Overdue label Jan 20, 2025
@rojiphil
Copy link
Contributor

Will review again today with the test branches.

@melvin-bot melvin-bot bot removed the Overdue label Jan 20, 2025
@rojiphil
Copy link
Contributor

Sorry for the delay here and thanks for sharing the test branches. I tested and it seems to work the same.

@huult I think going with the backTo approach (which is widely used and preferred pattern) makes sense unless there is any distinct advantage of using your approach.

@daledah Why is there a need to resetToHome during backTo as it looks like we are unnecessarily losing the navigation history?

@huult
Copy link
Contributor

huult commented Jan 22, 2025

@rojiphil Yes, my solution is a global fix because it eliminates the need to change or add backTo in the navigation. If we forget to include it, the issue will occur. Additionally, if we add new navigation in the future and forget or are unaware that we need to add backTo, the issue will happen again. I believe this highlights the distinct advantage of using my approach.

@daledah
Copy link
Contributor

daledah commented Jan 22, 2025

@daledah Why is there a need to resetToHome during backTo as it looks like we are unnecessarily losing the navigation history?

we added resetToHome in this PR to fix inconsistent navigation. But now in the workspace switcher screen there is no button to add new workspace. I tried deleting resetToHome and it still works well

Copy link

melvin-bot bot commented Jan 22, 2025

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

Copy link

melvin-bot bot commented Jan 27, 2025

@rojiphil, @maddylewis Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Jan 27, 2025
@rojiphil
Copy link
Contributor

Yes, my solution is a global fix because it eliminates the need to change or add backTo in the navigation. If we forget to include it, the issue will occur. Additionally, if we add new navigation in the future and forget or are unaware that we need to add backTo, the issue will happen again. I believe this highlights the distinct advantage of using my approach.

@huult Adding backTo is as per the design for navigation. So, I think eliminating the need to add backTo is not the way forward.

@melvin-bot melvin-bot bot removed the Overdue label Jan 27, 2025
Copy link

melvin-bot bot commented Jan 28, 2025

@rojiphil @maddylewis this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@rojiphil
Copy link
Contributor

The alternate solution in @daledah proposal i.e to use backTo LGTM,
🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 28, 2025

Triggered auto assignment to @neil-marcellini, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Jan 29, 2025

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

@neil-marcellini
Copy link
Contributor

The alternate solution in @daledah proposal i.e to use backTo LGTM, 🎀👀🎀 C+ reviewed

Yeah I agree. We shouldn't use the main solution with UP because the action doesn't match the definition here. backTo makes sense.

- `Up` - Pops the current screen off the current stack. This action is very easy to confuse with `Back`. Unless you’ve navigated from one screen to a nested screen in a stack of screens, these actions will almost always be the same. Unlike a “back” action, “up” should never result in the user exiting the app and should only be an option if there is somewhere to go “up” to.

@melvin-bot melvin-bot bot added the Overdue label Jan 30, 2025
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 30, 2025
Copy link

melvin-bot bot commented Jan 30, 2025

📣 @daledah 🎉 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 📖

Copy link

melvin-bot bot commented Feb 3, 2025

@rojiphil, @neil-marcellini, @maddylewis, @daledah Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Feb 3, 2025
@maddylewis
Copy link
Contributor

@rojiphil @daledah - can you provide an update on the status of this one when you have a chance? thanks!

@daledah
Copy link
Contributor

daledah commented Feb 4, 2025

I'll open PR soon

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Overdue Daily KSv2 labels Feb 4, 2025
@maddylewis
Copy link
Contributor

@daledah - can you provide an update on the status of the PR? thanks!

@rojiphil
Copy link
Contributor

@maddylewis PR is actively been worked upon with the latest updates today. Next step is a review from my end which I intend to pick up tomorrow my day.

This comment has been minimized.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 20, 2025
@melvin-bot melvin-bot bot changed the title [$250] Workspace - Inconsistent back navigation when clicking app back button [Due for payment 2025-02-27] [$250] Workspace - Inconsistent back navigation when clicking app back button Feb 20, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 20, 2025
Copy link

melvin-bot bot commented Feb 20, 2025

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

Copy link

melvin-bot bot commented Feb 20, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.2-1 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 2025-02-27. 🎊

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

Copy link

melvin-bot bot commented Feb 20, 2025

@rojiphil @maddylewis @rojiphil The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: MEDIUM
Development

No branches or pull requests

6 participants