aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-11-22 02:52:18 +0800
committerGitHub <noreply@github.com>2018-11-22 02:52:18 +0800
commit7229f0f9fcd6c2579c3c5a5146a3b144929b6d2e (patch)
tree0a791d664f82671ec8d4452523b9031dcc5e9237 /ui
parent74c18ef0e81e73873f0b57f3f0cc1afb5a05d8cc (diff)
downloadtangerine-wallet-browser-7229f0f9fcd6c2579c3c5a5146a3b144929b6d2e.tar
tangerine-wallet-browser-7229f0f9fcd6c2579c3c5a5146a3b144929b6d2e.tar.gz
tangerine-wallet-browser-7229f0f9fcd6c2579c3c5a5146a3b144929b6d2e.tar.bz2
tangerine-wallet-browser-7229f0f9fcd6c2579c3c5a5146a3b144929b6d2e.tar.lz
tangerine-wallet-browser-7229f0f9fcd6c2579c3c5a5146a3b144929b6d2e.tar.xz
tangerine-wallet-browser-7229f0f9fcd6c2579c3c5a5146a3b144929b6d2e.tar.zst
tangerine-wallet-browser-7229f0f9fcd6c2579c3c5a5146a3b144929b6d2e.zip
Fix usage of setState in ConfirmTransactionBase#handleSubmit (#5799)
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js45
1 files changed, 29 insertions, 16 deletions
diff --git a/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js
index 0651c676b..e3abde233 100644
--- a/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js
+++ b/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js
@@ -295,22 +295,35 @@ export default class ConfirmTransactionBase extends Component {
return
}
- this.setState({ submitting: true, submitError: null })
-
- if (onSubmit) {
- Promise.resolve(onSubmit(txData))
- .then(this.setState({ submitting: false }))
- } else {
- sendTransaction(txData)
- .then(() => {
- clearConfirmTransaction()
- this.setState({ submitting: false })
- history.push(DEFAULT_ROUTE)
- })
- .catch(error => {
- this.setState({ submitting: false, submitError: error.message })
- })
- }
+ this.setState({
+ submitting: true,
+ submitError: null,
+ }, () => {
+ if (onSubmit) {
+ Promise.resolve(onSubmit(txData))
+ .then(() => {
+ this.setState({
+ submitting: false,
+ })
+ })
+ } else {
+ sendTransaction(txData)
+ .then(() => {
+ clearConfirmTransaction()
+ this.setState({
+ submitting: false,
+ }, () => {
+ history.push(DEFAULT_ROUTE)
+ })
+ })
+ .catch(error => {
+ this.setState({
+ submitting: false,
+ submitError: error.message,
+ })
+ })
+ }
+ })
}
renderTitleComponent () {