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

[$500] Workspace creation - 'Hmm... it's not here' in NewDot after workspace creation under OldDot #32479

Closed
6 tasks
flodnv opened this issue Dec 5, 2023 · 14 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 Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@flodnv
Copy link
Contributor

flodnv commented Dec 5, 2023

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:
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): everyone
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/334523
Issue reported by: Applause
Slack conversation: N/A - short internal discussion here

Action Performed:

Prerequisites: Must log out from OldDot and NewDot

  1. Go to www.expensify.com
  2. Create a new Gmail account
  3. Go to www.expensify.com/pricing
  4. Choose the Free plan option to create a workspace
  5. Confirm that you're redirected to NewDot
  6. Verify that you're already logged in and directed to the Edit Workspace modal

Expected Result:

Get logged in and directed to the Edit Workspace modal

Actual Result:

Get logged in and directed to 'Hmmm it's not there' error

Workaround:

Yes

Platforms:

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

Probably all

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

Screenshots/Videos

Screen.Recording.2023-12-04.at.14.12.15.mov
Recording.1965.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0196515bd9ca529284
  • Upwork Job ID: 1732054374771777536
  • Last Price Increase: 2023-12-05
@flodnv flodnv 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 Dec 5, 2023
@melvin-bot melvin-bot bot changed the title Workspace creation - 'Hmm... it's not here' in NewDot after workspace creation under OldDot [$500] Workspace creation - 'Hmm... it's not here' in NewDot after workspace creation under OldDot Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

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

Copy link

melvin-bot bot commented Dec 5, 2023

Triggered auto assignment to @dylanexpensify (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 Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Dec 5, 2023

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

@AmjedNazzal
Copy link
Contributor

AmjedNazzal commented Dec 5, 2023

Proposal

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

Workspace creation - 'Hmm... it's not here' in NewDot after workspace creation under OldDot

What is the root cause of that problem?

In this PR while the new navigation was being made, it was decided that the user will be redirected to /workspace/new after validation:

App/src/libs/actions/App.ts

Lines 407 to 409 in 0a4db44

if (shouldCreateFreePolicy) {
createWorkspaceWithPolicyDraftAndNavigateToIt(policyOwnerEmail, policyName, true, makeMeAdmin);
return;

But actually we don't want to navigate to /workspace/new as that's not a valid url, the reason we are using that is to have components check if exitTo === /workspace/new to know that we should create a new workspace, however, the following component code will result in the final navigation actually being /workspace/new which we don't want:

if (exitTo && !props.account.isLoading && !isLoggingInAsNewUser) {
Navigation.isNavigationReady().then(() => {
Navigation.navigate(exitTo);
});

This navigation will override App.setUpPoliciesAndNavigate(session) that is being called in AuthScreens, resulting in the workspace not being created and the navigation landing on the invalid /workspace/new

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

In LogOutPreviousUserPage component, we must first check if exitTo === /workspace/new and if it does we should call App.setUpPoliciesAndNavigate(session) and return early to prevent actually navagating to /workspace/new, this way we will only navigate to exitTo if it's not /workspace/new

if (exitTo && !props.account.isLoading && !isLoggingInAsNewUser) {
    Navigation.isNavigationReady()
    .then(() => {
    if(exitTo === ROUTES.WORKSPACE_NEW){
        App.setUpPoliciesAndNavigate(props.session);
        return;
    }
        Navigation.navigate(exitTo)
    });
}

Result

Screen.Recording.2023-12-05.at.9.29.33.PM.mov

@dylanexpensify
Copy link
Contributor

Reviewing shortly!

@AmjedNazzal
Copy link
Contributor

Please note, I have significantly changed my proposal as I was not happy with it.

@flodnv
Copy link
Contributor Author

flodnv commented Dec 6, 2023

@alitoshmatov could you please review the proposal?

@alitoshmatov
Copy link
Contributor

Reviewing

@alitoshmatov
Copy link
Contributor

@AmjedNazzal
Code snippet you provided is resulting in triggering setUpPoliciesAndNavigate two times resulting in 2 draft workspaces

@alitoshmatov
Copy link
Contributor

If you noticed this code is running first

App/src/libs/actions/App.ts

Lines 411 to 420 in 0a4db44

if (!isLoggingInAsNewUser && exitTo) {
Navigation.isNavigationReady()
.then(() => {
// We must call goBack() to remove the /transition route from history
Navigation.goBack(ROUTES.HOME);
Navigation.navigate(exitTo);
})
.then(endSignOnTransition);
}
}

then code in logout user page is running. Why the first navigation is not taking effect?

Even adding condition to prevent this whole navigation is from running is not helping

if (exitTo && !props.account.isLoading && !isLoggingInAsNewUser) {
Navigation.isNavigationReady().then(() => {
Navigation.navigate(exitTo);
});

@AmjedNazzal
Copy link
Contributor

@alitoshmatov I did notice the double creation issue at some point in earlier code I was working with but it seemed like I resolved it but I guess not so I will look into that. also to be fair I did notice general navigation issues such as things not getting executed when they should be and things getting called multiple times so I will look into all that and update my proposal when I have something.

@AmjedNazzal
Copy link
Contributor

Well, this issue has been resolved in this PR, not sure why that github issue was opened and worked on while this issue is ongoing but oh well.

@flodnv
Copy link
Contributor Author

flodnv commented Dec 8, 2023

Oh ok, I was not aware of the duplicate issues, thanks for flagging

@flodnv flodnv closed this as completed Dec 8, 2023
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 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

4 participants