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-04-09] [$500] Workspace - The left side bar remains as chat when clicking on WS invitation link #38824

Closed
2 of 6 tasks
lanitochka17 opened this issue Mar 22, 2024 · 37 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 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

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

Actual Result:

  1. Go to staging.new.expensify.com
  2. Go to Profile > Workspaces
  3. Create a new workspace
  4. Click Share icon
  5. Click Copy
  6. Paste the link in chat and send it
  7. Click on the link

Expected Result:

The left side bar will be menu

Actual Result:

The left side bar remains as chat when clicking on WS invitation link

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

Bug6423434_1711128140057.20240323_011952.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01959b571907654054
  • Upwork Job ID: 1771275226175332352
  • Last Price Increase: 2024-04-09
  • Automatic offers:
    • Ollyws | Reviewer | 0
    • tienifr | Contributor | 0
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Mar 22, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Mar 22, 2024

Triggered auto assignment to @iwiznia (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@lanitochka17
Copy link
Author

@iwiznia 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

@lanitochka17
Copy link
Author

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

@iwiznia
Copy link
Contributor

iwiznia commented Mar 22, 2024

The left side bar will be menu

I have no idea what this means, can someone clarify?

@ahmedGaber93
Copy link
Contributor

@iwiznia
it means it should be profile menu not chat list menu

Expected Result:

Screenshot 2024-03-22 at 8 47 40 PM

Actual Result:

Screenshot 2024-03-22 at 8 51 01 PM

@ghost
Copy link

ghost commented Mar 22, 2024

Proposal

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

Workspace - The left side bar remains as chat when clicking on WS invitation link

What is the root cause of that problem?

Here :

Navigation.goBack(undefined, false, true);

we are defining routes as Navigation.goBack(undefined, false, true); which is taking us back but with inconsistency as
Navigation.goBack method is used to return to the previous screen, passing undefined to not pop any screens from the stack, false to not animate the transition, and true to dismiss the keyboard if open but while doing all that it causes inconsistency and we have already defined navigateAfterJoinRequest which is taking care of it.

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

So, we need to replace this -

Navigation.goBack(undefined, false, true);

with this - navigateAfterJoinRequest();

What alternative solutions did you explore? (Optional)

I think alternatively we can navigate the user to Workspace Initial Page :

Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID ?? ''));

Result

Screen.Recording.2024-03-23.at.1.30.08.AM.mp4

@ghost
Copy link

ghost commented Mar 22, 2024

Updated Proposal with result

@iwiznia iwiznia added the External Added to denote the issue can be worked on by a contributor label Mar 22, 2024
Copy link

melvin-bot bot commented Mar 22, 2024

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

@melvin-bot melvin-bot bot changed the title Workspace - The left side bar remains as chat when clicking on WS invitation link [$500] Workspace - The left side bar remains as chat when clicking on WS invitation link Mar 22, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 22, 2024
Copy link

melvin-bot bot commented Mar 22, 2024

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

@allgandalf
Copy link
Contributor

allgandalf commented Mar 22, 2024

Proposal

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

What is the root cause of that problem?

We are simply navigating back to the previous route if the user is the policy member of the workspace which causes this error:

Navigation.goBack(undefined, false, true);

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

We should navigate to the Settings page of that Workspace if the currrent user is already the member of workspace:

Navigation.Navigate(ROUTES.WORKSPACE_INITIAL.getRoute( policyID ?? '')); 

What alternative solutions did you explore? (Optional)

Not sure but we can navigate to all Workspace page:

SETTINGS_WORKSPACES: 'settings/workspaces',

@bernhardoj
Copy link
Contributor

Proposal

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

When we open a workspace invite link while already a member, the workspace list is shown with an LHN.

What is the root cause of that problem?

Currently, when we are already a member of the workspace, we will just close the page.

if (isPolicyMember) {
Navigation.goBack(undefined, false, true);
return;
}

But the logic above is triggered twice, so we got navigated twice. If we go from the chat/report screen to the workspace list page, then go to the report screen again [chat, WS, chat], then when the twice go back navigation happens, we arrive at the workspace list page instead of the LHN. The first go back pops the workspace join page, and the second go back pops the chat page.

The reason it is triggered twice is because of the onyx policies object changes. The second policies object somehow contains either policy_0, policy_undefined, or both. But if we deep link to the page, the onyx still re-renders the components with the same policies object even though the values are the same. After doing some investigation, onyx first provides the data when the component mounts, then it connects to the key and provides the data again when successfully connected, so we got the data twice even though they are the same.

For the policy_0 and policy_undefined, it happens because there are some component that tries to connect to those keys so it's added to the collection.

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

I'm not focusing on the onyx issue, but rather on the useEffect itself.

useEffect(() => {
if (!policy || !policies || isUnmounted.current || isJoinLinkUsed) {
return;
}
const isPolicyMember = PolicyUtils.isPolicyMember(policyID, policies as Record<string, Policy>);
if (isPolicyMember) {
Navigation.goBack(undefined, false, true);
return;
}
PolicyAction.inviteMemberToWorkspace(policyID, inviterEmail);
isJoinLinkUsed = true;
Navigation.isNavigationReady().then(() => {
if (isUnmounted.current) {
return;
}
navigateAfterJoinRequest();
});
}, [policy, policyID, policies, inviterEmail]);

I propose to remove the effect dependencies as I believe we only want to run the logic once and not every time one of the deps is updated.

btw, we should add Navigation.isNavigationReady() before calling the goBack, otherwise it will fail when we deep link to it

What alternative solutions did you explore? (Optional)

If we want to keep the deps, then we can memoize this
const isPolicyMember = PolicyUtils.isPolicyMember(policyID, policies as Record<string, Policy>);

const isPolicyMember = useMemo(() => PolicyUtils.isPolicyMember(policyID, policies as Record<string, Policy>), [policyID, policies]);

Then we can take out the policies object collection from the effect and replace it with isPolicyMember.

@tienifr
Copy link
Contributor

tienifr commented Mar 23, 2024

Proposal

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

The left side bar remains as chat when clicking on WS invitation link

What is the root cause of that problem?

In here, when the user is already a policy member, we're triggering Navigation.goBack(undefined, false, true); which will navigate the user back, which is not correct since the user wouldn't know what's going on, they're right back at the report screen, which seems more like the navigation doesn't work than they've been navigated to the right page by the link.

IMO we should:

  1. Navigate to the workspace initial page if the user is already a policy member
  2. Optionally show a message like "You're already a member of this workspace" to let the user know what's going on.

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

  1. We have to goBack, then navigate the user to the correct workspace page. We should replace this by
Navigation.isNavigationReady().then(() => {
    Navigation.goBack(undefined, false, true);
    Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID ?? '')); 
})

We have to:

  • goBack first, then navigate (unlike some proposals which suggest to replace goBack with navigate). Because we want to pop the current WorkspaceJoinUserPage first then navigate, otherwise if after navigation, the user goes back, they will incorrectly go back to the WorkspaceJoinUserPage. This is the approach used everywhere in the app like here
  • We have to do those navigation inside Navigation.isNavigationReady(), if not the navigation will not work and will cause unexpected navigation
  1. If we want to go with this, we should:
  • Add a route params when navigating back to WorkspaceInitialPage, like fromInviteLink=true (or we can use a simple JS variable, should be fine too)
  • In WorkspaceInitialPage if we see that fromInviteLink is true, show the "You're already a member of this workspace" (exact design can be provided by the design team)

What alternative solutions did you explore? (Optional)

For 1 instead of Navigation.goBack(undefined, false, true);, we could use Navigation.goBack()

Instead of WorkspaceInitialPage, another destination like ROUTES.SETTINGS_WORKSPACES could be considered, but definitely we should not just goBack, as I explained in the RCA it's confusing UX.

@Ollyws
Copy link
Contributor

Ollyws commented Mar 24, 2024

@tienifr's proposal LGTM.
🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 24, 2024

Current assignee @iwiznia is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@bernhardoj
Copy link
Contributor

@Ollyws hi, have you checked my proposal? I think the real issue here is the double navigation. Navigating to another page doesn't fix the root cause.

Without fixing the double navigation, you will see the user gets navigated to the WS page (if we navigate to it) twice.

Screen.Recording.2024-03-25.at.12.04.18.mov

@Ollyws
Copy link
Contributor

Ollyws commented Mar 25, 2024

@bernhardoj I did and I'm not sure that it's the root cause here.
I can't reproduce that issue with @tienifr's solution:

Screen.Recording.2024-03-25.at.11.26.48.mov

@bernhardoj
Copy link
Contributor

Oh my bad, I didn't put it inside the isNavigationReady promise. Somehow the promise resolve is only called once.

I'm not sure that it's the root cause here.

You can test (without changing any code) by clicking the link and see the chat page will close.

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

melvin-bot bot commented Mar 25, 2024

📣 @Ollyws 🎉 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

@melvin-bot melvin-bot bot changed the title [$500] Workspace - The left side bar remains as chat when clicking on WS invitation link [HOLD for payment 2024-04-09] [$500] Workspace - The left side bar remains as chat when clicking on WS invitation link Apr 2, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 2, 2024
Copy link

melvin-bot bot commented Apr 2, 2024

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

Copy link

melvin-bot bot commented Apr 2, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.58-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-04-09. 🎊

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

@Ollyws
Copy link
Contributor

Ollyws commented Apr 9, 2024

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR:

#37525

  • 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:

https://github.com/Expensify/App/pull/37525/files#r1557429884

  • 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:

N/A

  • Determine if we should create a regression test for this bug.

Yes.

  • 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.

Regression Test Proposal

1. Go to staging.new.expensify.com
2. Go to Profile > Workspaces
3. Create a new workspace
4. Click Share icon
5. Click Copy
6. Paste the link in chat and send it
7. Click on the link
8. Verify the menu appears in the left side bar

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot removed the Overdue label Apr 9, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Apr 9, 2024

@iwiznia Could we get a BZ member assigned for payment? Thanks.

@iwiznia iwiznia added External Added to denote the issue can be worked on by a contributor Bug Something is broken. Auto assigns a BugZero manager. and removed External Added to denote the issue can be worked on by a contributor labels Apr 9, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-04-09] [$500] Workspace - The left side bar remains as chat when clicking on WS invitation link [HOLD for payment 2024-04-09] [$250] Workspace - The left side bar remains as chat when clicking on WS invitation link Apr 9, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 9, 2024
Copy link

melvin-bot bot commented Apr 9, 2024

Current assignee @Ollyws is eligible for the External assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Apr 9, 2024

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

@Ollyws
Copy link
Contributor

Ollyws commented Apr 9, 2024

Hmm why did melvin downgrade the price to $250...I think this one should be $500 as it was created before the 5th April.

@joekaufmanexpensify
Copy link
Contributor

Yep, you're right.

@joekaufmanexpensify joekaufmanexpensify changed the title [HOLD for payment 2024-04-09] [$250] Workspace - The left side bar remains as chat when clicking on WS invitation link [HOLD for payment 2024-04-09] [$500] Workspace - The left side bar remains as chat when clicking on WS invitation link Apr 9, 2024
Copy link

melvin-bot bot commented Apr 9, 2024

Upwork job price has been updated to $500

@joekaufmanexpensify
Copy link
Contributor

Regression test is here: https://github.com/Expensify/Expensify/issues/386545

@joekaufmanexpensify
Copy link
Contributor

All set to issue payment. We need to pay:

@joekaufmanexpensify
Copy link
Contributor

@Ollyws $500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@tienifr $500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

All set. Thanks everyone!

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 Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

9 participants