Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Changes from 3 commits
0b75a8b
9318e5d
8fda0e3
0b6b408
ce7b7e7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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
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 forcanUseFreePlan
happens only in NewWorkSpace.jsI 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 callsetRedirectToWorkspaceNewAfterSignIn(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 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
andsession.accountID
are indefaultProps
and defaulted vialodashGet
in the other component. But still I don't mind not usinglodashGet
here sincethis.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.