-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Beta race fixes #4205
Beta race fixes #4205
Conversation
Testing steps for "Testing workspace/new" worked well 👍
Rebuilt web-e w/ grunt and works well! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, nothing life-changing. Overall looks great 👍
@@ -39,7 +43,11 @@ class ValidateLoginNewWorkspacePage extends Component { | |||
// by calling dismissModal(), the /v/... route is removed from history so the user will get taken to `/` | |||
// if they cancel out of the new workspace modal. | |||
Navigation.dismissModal(); | |||
Navigation.navigate(ROUTES.WORKSPACE_NEW); | |||
if (this.props.betas) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to comment in other file - how do you feel about using lodashGet
here (like below)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to use lodashGet here imo since the proptype and default are provided. The other example of lodashGet makes sense because accountID and validateCode are not defined in the defaultParams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but I did mention how session.authToken
and session.accountID
are in defaultProps
and defaulted via lodashGet
in the other component. But still I don't mind not using lodashGet
here since this.props.betas
is not nested in another onyx key 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i'm not going to add it atm since I don't see its value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, but I see a comment about potentially changing this up in the issue, so holding off on an approve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is necessary and I left a comment in the original issue here why I think so.
Also had some suggestions for this PR lmk what you think.
@@ -62,7 +66,12 @@ class ValidateLogin2FANewWorkspacePage extends Component { | |||
// by calling dismissModal(), the /v/... route is removed from history so the user will get taken to `/` | |||
// if they cancel out of the new workspace modal. | |||
Navigation.dismissModal(); | |||
Navigation.navigate(ROUTES.WORKSPACE_NEW); | |||
|
|||
if (this.props.betas) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are saving this behavior for the beta, why wouldn't we use
if (this.props.betas) { | |
if (Permissions.canUseFreePlan(this.props.betas)) { |
And similarily for other parts referencing this.props.betas
Otherwise, aren't we saying this can be used by anyone? When betas load they'll be []
for those who aren't in any beta so the else part below here wouldn't run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well ROUTES.WORKSPACE_NEW already does the check for Permissions.canUseFreePlan
so to keep the code DRY i think its best that the check for canUseFreePlan
happens only in NewWorkSpace.js
Otherwise, aren't we saying this can be used by anyone? When betas load they'll be [] for those who aren't in any beta so the else part below here wouldn't run.
I didn't follow your question. Maybe this helps. The if condition determines if newWorkSpace component should render now or later. This take care of race conditions. If we have loaded betas, even if its empty, then we call Navigation.navigate(ROUTES.WORKSPACE_NEW);
to render NewWorkSpace since there is no reason to wait. If betas is null, that means we're still waiting and hence we call setRedirectToWorkspaceNewAfterSignIn(true)
so that once the betas are loaded (even if its empty) we call Navigation.navigate(ROUTES.WORKSPACE_NEW); at a later time over here. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh yes that totally makes sense. Thanks for exposing that!
There's one line that's too long but this LGTM, don't block on me 👍 (aaaand you just got it lol) |
Updated code to address comments 👍 Ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@@ -39,7 +45,11 @@ class ValidateLoginNewWorkspacePage extends Component { | |||
// by calling dismissModal(), the /v/... route is removed from history so the user will get taken to `/` | |||
// if they cancel out of the new workspace modal. | |||
Navigation.dismissModal(); | |||
Navigation.navigate(ROUTES.WORKSPACE_NEW); | |||
if (_.isEmpty(this.props.betas)) { | |||
setRedirectToWorkspaceNewAfterSignIn(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chiragsalian I'm not quite understanding this, so can you explain it to me? If this logic runs, there is already an authToken, so why is the user being redirected to the new workspace page after sign in, when they are already signed in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the method name is not the best. Atm i just copied pasted the param i.e., redirectToWorkspaceNewAfterSignIn
. The functionality of this is more like redirectAfterSignInAndHaveNecessaryParams
. So yeah even though we have the authToken we don't have the betas loaded yet.
So if we go to Navigation.navigate(ROUTES.WORKSPACE_NEW)
without the betas it will fail and not show the component, which is the issue.
The betas take a little longer to load after being signed in which is why we save the redirect in onyx and then check if we have everything here before we can navigate to the component. Does that make sense?
As for the method name. Atm i just renamed it exactly to the variable. I thought once I continue with the QR code redirect project of mine I'll discuss the method name closely with you to make it more generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I understand about needing to wait for betas to load, but I'm still confused why setRedirectToWorkspaceNewAfterSignIn
is necessary. It wasn't in the original code, so it's being added for some reason, but I can't tell what that reason is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't in the original code, so it's being added for some reason, but I can't tell what that reason is.
Do you mean you can't tell easily tell what the reason is in the code and hence want me to add comments or you can't see the reason in general. Cause the reason its added is to fix the GH issue. Since its possible to sign in faster than getting betas, if we redirect to Navigation.navigate(ROUTES.WORKSPACE_NEW)
too early then the new workspace screen won't show up. You can easily reproduce the same on dev too with my test steps (Test step - Testing pricing redirect
while being signed out hits this flow). Let me know if that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed 1:1 and landing on a resolution to be made in my follow up QR scanning project work.
🚀 Deployed to staging in version: 1.0.80-3🚀
|
🚀 Deployed to production in version: 1.0.81-4🚀
|
@chiragsalian if this deployed to production, why hasn't it closed? |
oh good question, looks like some bug that didn't close the parent issue. I'll manually close the parent issue. |
Details
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/171345
Setup
which is what I did while working on the code.
Tests
Testing workspace/new
Testing pricing redirect.
QA Steps
Same steps as above except that you'll need to use an email that's on free plan beta.
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android