Fix onboarding persisting when changing routes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as _ from 'lodash';
|
||||
import * as React from 'react';
|
||||
import { RouteComponentProps, withRouter } from 'react-router';
|
||||
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Blockchain } from 'ts/blockchain';
|
||||
@@ -15,7 +16,7 @@ import { AllowanceToggle } from 'ts/containers/inputs/allowance_toggle';
|
||||
import { ProviderType, Token, TokenByAddress, TokenStateByAddress } from 'ts/types';
|
||||
import { utils } from 'ts/utils/utils';
|
||||
|
||||
export interface PortalOnboardingFlowProps {
|
||||
export interface PortalOnboardingFlowProps extends RouteComponentProps<any> {
|
||||
blockchain: Blockchain;
|
||||
stepIndex: number;
|
||||
isRunning: boolean;
|
||||
@@ -32,9 +33,15 @@ export interface PortalOnboardingFlowProps {
|
||||
refetchTokenStateAsync: (tokenAddress: string) => Promise<void>;
|
||||
}
|
||||
|
||||
export class PortalOnboardingFlow extends React.Component<PortalOnboardingFlowProps> {
|
||||
class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProps> {
|
||||
private _unlisten: () => void;
|
||||
public componentDidMount(): void {
|
||||
this._overrideOnboardingStateIfShould();
|
||||
// If there is a route change, just close onboarding.
|
||||
this._unlisten = this.props.history.listen(() => this.props.updateIsRunning(false));
|
||||
}
|
||||
public componentWillUnmount(): void {
|
||||
this._unlisten();
|
||||
}
|
||||
public componentDidUpdate(): void {
|
||||
this._overrideOnboardingStateIfShould();
|
||||
@@ -209,3 +216,5 @@ export class PortalOnboardingFlow extends React.Component<PortalOnboardingFlowPr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const PortalOnboardingFlow = withRouter(PlainPortalOnboardingFlow);
|
||||
|
@@ -270,7 +270,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
|
||||
<ListItem
|
||||
primaryText={
|
||||
<div className="flex right" style={styles.manageYourWalletText}>
|
||||
{'manage your wallet'}
|
||||
manage your wallet
|
||||
</div>
|
||||
// https://github.com/palantir/tslint-react/issues/140
|
||||
// tslint:disable-next-line:jsx-curly-spacing
|
||||
|
Reference in New Issue
Block a user