aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/tx-state-manager.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2018-04-30 07:00:13 +0800
committerfrankiebee <frankie.diamond@gmail.com>2018-04-30 07:32:16 +0800
commit7eb735651bcd1c3a4ef2b4da1be5d7444e282b44 (patch)
tree186eee6d8da45d03a139c6344829aeef5a91110b /app/scripts/controllers/transactions/tx-state-manager.js
parent873f85d9962ff569baa8a5bbf2c1337c3b920419 (diff)
downloadtangerine-wallet-browser-7eb735651bcd1c3a4ef2b4da1be5d7444e282b44.tar
tangerine-wallet-browser-7eb735651bcd1c3a4ef2b4da1be5d7444e282b44.tar.gz
tangerine-wallet-browser-7eb735651bcd1c3a4ef2b4da1be5d7444e282b44.tar.bz2
tangerine-wallet-browser-7eb735651bcd1c3a4ef2b4da1be5d7444e282b44.tar.lz
tangerine-wallet-browser-7eb735651bcd1c3a4ef2b4da1be5d7444e282b44.tar.xz
tangerine-wallet-browser-7eb735651bcd1c3a4ef2b4da1be5d7444e282b44.tar.zst
tangerine-wallet-browser-7eb735651bcd1c3a4ef2b4da1be5d7444e282b44.zip
transactions - run event emitters outside context of _setTxStatus
Diffstat (limited to 'app/scripts/controllers/transactions/tx-state-manager.js')
-rw-r--r--app/scripts/controllers/transactions/tx-state-manager.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js
index 53428c333..17938e70f 100644
--- a/app/scripts/controllers/transactions/tx-state-manager.js
+++ b/app/scripts/controllers/transactions/tx-state-manager.js
@@ -398,13 +398,15 @@ class TransactionStateManager extends EventEmitter {
_setTxStatus (txId, status) {
const txMeta = this.getTx(txId)
txMeta.status = status
- this.emit(`${txMeta.id}:${status}`, txId)
- this.emit(`tx:status-update`, txId, status)
- if (['submitted', 'rejected', 'failed'].includes(status)) {
- this.emit(`${txMeta.id}:finished`, txMeta)
- }
- this.updateTx(txMeta, `txStateManager: setting status to ${status}`)
- this.emit('update:badge')
+ setTimeout(() => {
+ this.updateTx(txMeta, `txStateManager: setting status to ${status}`)
+ this.emit(`${txMeta.id}:${status}`, txId)
+ this.emit(`tx:status-update`, txId, status)
+ if (['submitted', 'rejected', 'failed'].includes(status)) {
+ this.emit(`${txMeta.id}:finished`, txMeta)
+ }
+ this.emit('update:badge')
+ })
}
/**