aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/onboarding
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-19 08:24:31 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-19 08:24:31 +0800
commitbdd299dd9ee4699ccf5a4ab648e721e03ab2a139 (patch)
tree3cb70ff3a234bf33a5e3db7767153d010fe48b88 /packages/website/ts/components/onboarding
parentdb9ff7675404b6d409cc195159a8334c59208c25 (diff)
downloaddexon-0x-contracts-bdd299dd9ee4699ccf5a4ab648e721e03ab2a139.tar.gz
dexon-0x-contracts-bdd299dd9ee4699ccf5a4ab648e721e03ab2a139.tar.zst
dexon-0x-contracts-bdd299dd9ee4699ccf5a4ab648e721e03ab2a139.zip
Fix onboarding persisting when changing routes
Diffstat (limited to 'packages/website/ts/components/onboarding')
-rw-r--r--packages/website/ts/components/onboarding/portal_onboarding_flow.tsx13
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx
index 4283022e2..159fd27e6 100644
--- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx
+++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx
@@ -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);