Only auto-start onboarding if blockchain is loaded

This commit is contained in:
fragosti
2018-07-02 15:52:59 -07:00
parent 300c9f09b9
commit 8c5dc7cecd

View File

@@ -46,7 +46,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
public componentDidMount(): void {
this._adjustStepIfShould();
// Wait until the step is adjusted to decide whether we should show onboarding.
setTimeout(this._autoStartOnboardingIfShould.bind(this), 1000);
// setTimeout(this._autoStartOnboardingIfShould.bind(this), 1000);
// If there is a route change, just close onboarding.
this._unlisten = this.props.history.listen(() => this.props.updateIsRunning(false));
}
@@ -61,6 +61,9 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
document.querySelector('.wallet').scrollIntoView();
}
}
if (!prevProps.blockchainIsLoaded && this.props.blockchainIsLoaded) {
this._autoStartOnboardingIfShould();
}
}
public render(): React.ReactNode {
return (
@@ -221,7 +224,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
}
private _autoStartOnboardingIfShould(): void {
if (
(this.props.stepIndex === 0 && !this.props.isRunning) ||
(this.props.stepIndex === 0 && !this.props.isRunning && this.props.blockchainIsLoaded) ||
(!this.props.isRunning && !this.props.hasBeenClosed && this.props.blockchainIsLoaded)
) {
const networkName = sharedConstants.NETWORK_NAME_BY_ID[this.props.networkId];