Skip to content

Commit

Permalink
transactions - run event emitters outside context of _setTxStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiebee committed Apr 29, 2018
1 parent 873f85d commit 7eb7356
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/scripts/controllers/transactions/tx-state-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
}

/**
Expand Down

0 comments on commit 7eb7356

Please sign in to comment.