aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorEsteban MIno <efmino@uc.cl>2018-07-26 08:58:20 +0800
committerEsteban MIno <efmino@uc.cl>2018-07-26 08:58:20 +0800
commitb580f60d749b862fe08adfc7457c726905ebc623 (patch)
tree67ed42290a0f1a9840c18d996c81f56e26042974 /ui
parentc8d45cb4a8a671bad20cd5a5aa1bcbbd88463bdb (diff)
downloadtangerine-wallet-browser-b580f60d749b862fe08adfc7457c726905ebc623.tar.gz
tangerine-wallet-browser-b580f60d749b862fe08adfc7457c726905ebc623.tar.zst
tangerine-wallet-browser-b580f60d749b862fe08adfc7457c726905ebc623.zip
earliest tx by submittedTime
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/tx-list-item.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js
index 92466568c..1a639d0b9 100644
--- a/ui/app/components/tx-list-item.js
+++ b/ui/app/components/tx-list-item.js
@@ -213,6 +213,7 @@ TxListItem.prototype.showRetryButton = function () {
if (!txParams) {
return false
}
+ let currentTxIsLatest = false
const currentNonce = txParams.nonce
const currentNonceTxs = selectedAddressTxList.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted')
@@ -220,11 +221,13 @@ TxListItem.prototype.showRetryButton = function () {
const lastSubmittedTxWithCurrentNonce = currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1]
const currentTxIsLatestWithNonce = lastSubmittedTxWithCurrentNonce &&
lastSubmittedTxWithCurrentNonce.id === transactionId
- const lastTx = currentSubmittedTxs.reduce((tx1, tx2) => {
- if (tx1.id < tx2.id) return tx1
- return tx2
- })
- const currentTxIsLatest = lastTx.id === transactionId
+ if (currentSubmittedTxs.length > 0) {
+ const lastTx = currentSubmittedTxs.reduce((tx1, tx2) => {
+ if (tx1.submittedTime < tx2.submittedTime) return tx1
+ return tx2
+ })
+ currentTxIsLatest = lastTx.id === transactionId
+ }
return currentTxIsLatestWithNonce && Date.now() - transactionSubmittedTime > 30000 && currentTxIsLatest
}