From 52443c53072ffb36ebfe457ac9dcad4f00f60a5f Mon Sep 17 00:00:00 2001 From: apanizo Date: Thu, 26 Jul 2018 13:40:19 +0200 Subject: [PATCH] WA-232 Fix onReset behaviour --- src/routes/tokens/component/Layout.jsx | 5 +++++ src/routes/tokens/component/RemoveToken/index.jsx | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/routes/tokens/component/Layout.jsx b/src/routes/tokens/component/Layout.jsx index 4949e0e7..9fdaa867 100644 --- a/src/routes/tokens/component/Layout.jsx +++ b/src/routes/tokens/component/Layout.jsx @@ -49,6 +49,10 @@ class TokenLayout extends React.PureComponent { }) } + onReset = () => { + this.setState({ component: undefined }) + } + onRemoveToken = (token: Token) => { const { safeAddress, removeToken } = this.props @@ -57,6 +61,7 @@ class TokenLayout extends React.PureComponent { token={token} safeAddress={safeAddress} removeTokenAction={removeToken} + onReset={this.onReset} />, }) } diff --git a/src/routes/tokens/component/RemoveToken/index.jsx b/src/routes/tokens/component/RemoveToken/index.jsx index 50a70f1c..427be33a 100644 --- a/src/routes/tokens/component/RemoveToken/index.jsx +++ b/src/routes/tokens/component/RemoveToken/index.jsx @@ -13,6 +13,7 @@ type Props = { token: Token, safeAddress: string, removeTokenAction: typeof RemoveTokenAction, + onReset: () => void, } type State = { @@ -21,17 +22,16 @@ type State = { export const REMOVE_TOKEN_RESET_BUTTON_TEXT = 'RESET' -export const removeToken = (safeAddress: string, token: Token, removeTokenAction: typeof RemoveTokenAction) => { +export const removeToken = async (safeAddress: string, token: Token, removeTokenAction: typeof RemoveTokenAction) => removeTokenAction(safeAddress, token) -} class RemoveToken extends React.PureComponent { state = { done: false, } - onReset = () => { - this.setState({ done: false }) + onRemoveReset = () => { + this.setState({ done: false }, this.props.onReset()) } executeRemoveOperation = async () => { @@ -59,7 +59,7 @@ class RemoveToken extends React.PureComponent { finishedButton={finishedButton} onSubmit={this.executeRemoveOperation} steps={steps} - onReset={this.onReset} + onReset={this.onRemoveReset} > { Review }