aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--old-ui/app/components/transaction-list-item.js13
-rw-r--r--ui/app/components/tx-list-item.js13
2 files changed, 16 insertions, 10 deletions
diff --git a/old-ui/app/components/transaction-list-item.js b/old-ui/app/components/transaction-list-item.js
index e12f9cd6a..f479ce666 100644
--- a/old-ui/app/components/transaction-list-item.js
+++ b/old-ui/app/components/transaction-list-item.js
@@ -36,6 +36,7 @@ TransactionListItem.prototype.showRetryButton = function () {
return false
}
+ let currentTxIsLatest = false
const currentNonce = txParams.nonce
const currentNonceTxs = transactions.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted')
@@ -43,12 +44,14 @@ TransactionListItem.prototype.showRetryButton = function () {
const lastSubmittedTxWithCurrentNonce = currentNonceSubmittedTxs[0]
const currentTxIsLatestWithNonce = lastSubmittedTxWithCurrentNonce &&
lastSubmittedTxWithCurrentNonce.id === transaction.id
- const lastTx = currentSubmittedTxs.reduce((tx1, tx2) => {
- if (tx1.id < tx2.id) return tx1
- return tx2
- })
+ if (currentSubmittedTxs.length > 0) {
+ const lastTx = currentSubmittedTxs.reduce((tx1, tx2) => {
+ if (tx1.submittedTime < tx2.submittedTime) return tx1
+ return tx2
+ })
+ currentTxIsLatest = lastTx.id === transaction.id
+ }
- const currentTxIsLatest = lastTx.id === transaction.id
return currentTxIsLatestWithNonce && Date.now() - submittedTime > 30000 && currentTxIsLatest
}
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
}