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

[PAYMENT DUE 2024-03-06] [$500] RHP - User redirected from "Room" tab to "Chat" tab when tapped on the back button #35143

Closed
6 tasks done
kavimuru opened this issue Jan 25, 2024 · 29 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kavimuru
Copy link

kavimuru commented Jan 25, 2024

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: 1.4.31-1
Reproducible in staging?: y
Reproducible in production?: y
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: Applause internal team
Slack conversation:

Action Performed:

  1. Open app
  2. Tap on FAB
  3. Select "Start Chat"
  4. Select "Room" tab
  5. Tap on back button

Expected Result:

RHP should be closed and user should be navigated to LHN when user tapped on back button

Actual Result:

User redirected from "Room" tab to "Chat" tab when tapped on the back button

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

Bug6354481_1706178877493.screen-20240125-020533.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a7c80f42a2fdfb07
  • Upwork Job ID: 1750499615463923712
  • Last Price Increase: 2024-01-25
  • Automatic offers:
    • situchan | Reviewer | 28134705
    • bernhardoj | Contributor | 28134706
@kavimuru kavimuru added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 25, 2024
@melvin-bot melvin-bot bot changed the title RHP - User redirected from "Room" tab to "Chat" tab when tapped on the back button [$500] RHP - User redirected from "Room" tab to "Chat" tab when tapped on the back button Jan 25, 2024
Copy link

melvin-bot bot commented Jan 25, 2024

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

Copy link

melvin-bot bot commented Jan 25, 2024

Triggered auto assignment to @peterdbarkerUK (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

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

melvin-bot bot commented Jan 25, 2024

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

@abzokhattab
Copy link
Contributor

abzokhattab commented Jan 25, 2024

Proposal

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

User redirected from "Room" tab to "Chat" tab when tapped on the back button

What is the root cause of that problem?

there is no on onBackButtonPress prop bassed to the header which causes it to use the default behaviour which is goBack() so the navigator goes back to the prev page

<HeaderWithBackButton title={props.translate('sidebarScreen.fabNewChat')} />

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

need to add modal dismiss as the action of the onBackButtonPress prop

    <HeaderWithBackButton
                onBackButtonPress={Navigation.dismissModal}
                title={props.translate('sidebarScreen.fabNewChat')}
            />

alternatively

we can use navigation replace instead of the navigate when clicking on a tab so that it replaces the current navigation state with the target tab route

navigation.navigate({key: route.key, merge: true});

@Pujan92
Copy link
Contributor

Pujan92 commented Jan 25, 2024

Proposal

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

On back for new chat selector the modal is not dismissed

What is the root cause of that problem?

It seems to be intentional from this PR where we have removed dismissing the modal for issue #27669. Issue was - when the modal is opened for settings and if we use keyboard shortcut CTRL+SHIFT+K to open start chat and click back then it is not going back to the settings modal.

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

If the requirement is to dismiss the modal then we can re-add the onBackButtonPress which will dismiss the modal.

@JordanLevy19
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.
When a user selects the 'Room' tab within the 'New Chat' page and then taps the back button, the app redirects them to the 'Chat' tab instead of closing the Right Hand Panel (RHP) and returning them to the Left Hand Navigation (LHN)

What is the root cause of that problem?
The root of the issue may be found within the following parts of the code:

HeaderWithBackButton: The HeaderWithBackButton is responsible for rendering the back button on the header. The specific behavior when the back button is pressed (such as closing the panel or switching tabs) is not detailed here, which suggests that the logic is defined elsewhere, possibly in a parent component or within the HeaderWithBackButton's implementation itself.

<HeaderWithBackButton title={props.translate('sidebarScreen.fabNewChat')} />

OnyxTabNavigator: The OnyxTabNavigator manages the tab navigation. It includes a custom tabBar prop that uses TabSelector. If the logic associated with the back button is tied into the tab navigator’s state, it might be causing the incorrect navigation.

<OnyxTabNavigator
id={CONST.TAB.NEW_CHAT_TAB_ID}
tabBar={({state, navigation, position}) => (
    <TabSelector
        state={state}
        navigation={navigation}
        position={position}
    />
)}
<TopTab.Screen
    name={CONST.TAB.NEW_CHAT}
    component={NewChatPage}
/>
<TopTab.Screen
    name={CONST.TAB.NEW_ROOM}
    component={WorkspaceNewRoomPage}
/>

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

Review and Update HeaderWithBackButton Logic:
Investigate the implementation of the HeaderWithBackButton. Ensure that the back button is configured to close the Right Hand Panel (RHP) and return to the Left Hand Navigation (LHN) instead of switching tabs.
If necessary, update the onPress handler to explicitly define the desired navigation action.

Adjust Navigation State Management in OnyxTabNavigator:
Review how OnyxTabNavigator manages the navigation state, especially in relation to the back button actions. Ensure that the tab navigator's state management doesn't override or conflict with the back button's intended functionality.

@bernhardoj
Copy link
Contributor

bernhardoj commented Jan 25, 2024

Proposal

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

Pressing back in start chat page goes to the previous tab.

What is the root cause of that problem?

The back button will call Navigation.goBack() which will call navigationRef.current.goBack().

onBackButtonPress = () => Navigation.goBack(ROUTES.HOME),

navigationRef is the ref of the root NavigationContainer

<NavigationContainer
onStateChange={handleStateChange}
onReady={onReady}
theme={navigationTheme}
ref={navigationRef}

and when we call goBack on it, it will pop the navigation history one by one including the tab history.

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

Use useNavigation hook to get the navigation object that "belongs" to the Start Chat stack and call goBack using the navigation object. This way, it will pop the Start Chat from the stack.

NewChatSelectorPage.js

const navigation = useNavigation();

<HeaderWithBackButton title={props.translate('sidebarScreen.fabNewChat')} onBackButtonPress={() => navigation.goBack()} />

@adarsh0raj
Copy link

Proposal

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

After selecting 'Room' Tab in Right Hand Panel, and then clicking on Back Button, the user is redirected to 'Chat' Tab. The ideal behaviour should be closing the Right Hand Panel and going back to LHN.

What is the root cause of that problem?

The root cause is not passing an updated prop value for the function 'onBackButtonPress()', in the component HeaderWithBackButton. This leads to its default behaviour.

Integration of Component:

<HeaderWithBackButton title={props.translate('sidebarScreen.fabNewChat')} />

The default behaviour of 'onBackButtonPress()' function defined in the component is to call 'Navigation.goBack(ROUTES.Home)', as can be seen in the following line. The goBack() function is implemented in 'libs/Navigation' in such a way that it takes multiple arguments, in which one argument is "shouldPopToTop" which is "false" by default. Hence, when we are calling the goBack function it is not going to LHN, as we are not passing the "shouldPopToTop" param as true in the default function above.

onBackButtonPress = () => Navigation.goBack(ROUTES.HOME),

image

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

We can update the 'onBackButtonPress()' in the call as below, after importing Navigation from libs in 'NewChatSelectorPage'. Or passing True for 'shouldPopToTop' which will take the user directly to LHN.

<HeaderWithBackButton 
      title={props.translate('sidebarScreen.fabNewChat')} 
      // First Option:    onBackButtonPress={Navigation.dismissModal} 
      // Second Option:    onBackButtonPress={Navigation.goBack(ROUTES.HOME, false, true)}
/>

Copy link

melvin-bot bot commented Jan 25, 2024

📣 @adarsh0raj! 📣
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>

@adarsh0raj
Copy link

Contributor details
Your Expensify account email: testadarsh72@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01e6080583f375d0d1

Copy link

melvin-bot bot commented Jan 25, 2024

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

@situchan
Copy link
Contributor

Search page is moved to LHP so New chat page can no longer be compared to Search page for consistency check.

@melvin-bot melvin-bot bot added the Overdue label Jan 29, 2024
@situchan
Copy link
Contributor

Personally I am looking for solution to skip tab navigation default behavior on navigation back. So as if there were not tab navigator.

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2024
@bernhardoj
Copy link
Contributor

Personally I am looking for solution to skip tab navigation default behavior on navigation back

My proposal did this.

@melvin-bot melvin-bot bot added the Overdue label Jan 31, 2024
@situchan
Copy link
Contributor

situchan commented Feb 1, 2024

@bernhardoj's proposal looks good to me.
Other proposals cause regression of closing all RHP modals (i.e. Cmd+Shift+K on Settings page)

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Feb 1, 2024
Copy link

melvin-bot bot commented Feb 1, 2024

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

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

melvin-bot bot commented Feb 1, 2024

📣 @situchan 🎉 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 Feb 1, 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 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 1, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @situchan

@kadiealexander kadiealexander added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Feb 1, 2024
Copy link

melvin-bot bot commented Feb 1, 2024

Triggered auto assignment to @zanyrenney (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 1, 2024
Copy link

melvin-bot bot commented Feb 9, 2024

@Beamanator, @bernhardoj, @zanyrenney, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

@Beamanator
Copy link
Contributor

PR still in progress

@zanyrenney
Copy link
Contributor

what's the ETA on the PR @Beamanator ?

@Beamanator
Copy link
Contributor

As you can see in the PR linked a bit above, I just bumped @situchan for another review

Copy link

melvin-bot bot commented Feb 26, 2024

@Beamanator, @bernhardoj, @zanyrenney, @situchan Eep! 4 days overdue now. Issues have feelings too...

@situchan
Copy link
Contributor

PR was merged

@zanyrenney
Copy link
Contributor

nice stuff re the merge. thanks!

@zanyrenney
Copy link
Contributor

PR was merged and deployed to prod5 days ago, waiting the 7 day period and then will do payments.

@zanyrenney zanyrenney changed the title [$500] RHP - User redirected from "Room" tab to "Chat" tab when tapped on the back button [PAYMENT DUE 2024-03-06] [$500] RHP - User redirected from "Room" tab to "Chat" tab when tapped on the back button Mar 4, 2024
@zanyrenney
Copy link
Contributor

Payment summary
@bernhardoj $500 PAID on upwork
@situchan $500 PAID on upwork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests