-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Beta race fixes #4205
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
Changes from 4 commits
0b75a8b
9318e5d
8fda0e3
0b6b408
ce7b7e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,14 @@ import {Component} from 'react'; | |
import PropTypes from 'prop-types'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import lodashGet from 'lodash/get'; | ||
import _ from 'underscore'; | ||
import validateLinkPropTypes from './validateLinkPropTypes'; | ||
import compose from '../libs/compose'; | ||
import ONYXKEYS from '../ONYXKEYS'; | ||
import Navigation from '../libs/Navigation/Navigation'; | ||
import ROUTES from '../ROUTES'; | ||
import {continueSessionFromECom} from '../libs/actions/Session'; | ||
import {continueSessionFromECom, setRedirectToWorkspaceNewAfterSignIn} from '../libs/actions/Session'; | ||
|
||
|
||
const propTypes = { | ||
/* Onyx Props */ | ||
|
@@ -20,13 +22,17 @@ const propTypes = { | |
|
||
/** The accountID and validateCode are passed via the URL */ | ||
route: validateLinkPropTypes, | ||
|
||
/** List of betas */ | ||
betas: PropTypes.arrayOf(PropTypes.string), | ||
}; | ||
|
||
const defaultProps = { | ||
route: { | ||
params: {}, | ||
}, | ||
session: {}, | ||
betas: [], | ||
}; | ||
class ValidateLoginNewWorkspacePage extends Component { | ||
componentDidMount() { | ||
|
@@ -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 commentThe 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 commentThe 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., 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
} else { | ||
Navigation.navigate(ROUTES.WORKSPACE_NEW); | ||
} | ||
return; | ||
} | ||
|
||
|
@@ -63,5 +73,8 @@ export default compose( | |
session: { | ||
key: ONYXKEYS.SESSION, | ||
}, | ||
betas: { | ||
key: ONYXKEYS.BETAS, | ||
}, | ||
}), | ||
)(ValidateLoginNewWorkspacePage); |
Uh oh!
There was an error while loading. Please reload this page.