From 543f2c91fe3d00be33b2193eb88529a53622506a Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 22 Jun 2018 11:37:57 -0700 Subject: Pulled out reset AssetPicker state into a common variable --- .../ts/components/generate_order/asset_picker.tsx | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'packages/website') diff --git a/packages/website/ts/components/generate_order/asset_picker.tsx b/packages/website/ts/components/generate_order/asset_picker.tsx index 738692264..87618f1e0 100644 --- a/packages/website/ts/components/generate_order/asset_picker.tsx +++ b/packages/website/ts/components/generate_order/asset_picker.tsx @@ -232,12 +232,14 @@ export class AssetPicker extends React.Component { + const resetState: AssetPickerState = { + ...this.state, + isAddingTokenToTracked: false, + assetView: AssetViews.ASSET_PICKER, + chosenTrackTokenAddress: undefined, + }; if (!didUserAcceptTracking) { - this.setState({ - isAddingTokenToTracked: false, - assetView: AssetViews.ASSET_PICKER, - chosenTrackTokenAddress: undefined, - }); + this.setState(resetState); this._onCloseDialog(); return; } @@ -247,11 +249,7 @@ export class AssetPicker extends React.Component