1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Undefined check in showRetryButton

This commit is contained in:
Dan 2018-03-13 21:32:22 -02:30
parent e293b6349c
commit 8c7988978f
2 changed files with 8 additions and 6 deletions

View File

@ -34,10 +34,11 @@ TransactionListItem.prototype.showRetryButton = function () {
const currentNonce = txParams.nonce
const currentNonceTxs = transactions.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted')
const isLastSubmittedTxWithCurrentNonce =
currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1].id === transaction.id
const lastSubmittedTxWithCurrentNonce = currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1]
const currentTxIsLatestWithNonce = lastSubmittedTxWithCurrentNonce
&& lastSubmittedTxWithCurrentNonce.id === transaction.id
return isLastSubmittedTxWithCurrentNonce && Date.now() - submittedTime > 30000
return currentTxIsLatestWithNonce && Date.now() - submittedTime > 30000
}
TransactionListItem.prototype.render = function () {

View File

@ -186,10 +186,11 @@ TxListItem.prototype.showRetryButton = function () {
const currentNonce = txParams.nonce
const currentNonceTxs = selectedAddressTxList.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => transactionStatus === 'submitted')
const isLastSubmittedTxWithCurrentNonce =
currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1].id === transactionId
const lastSubmittedTxWithCurrentNonce = currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1]
const currentTxIsLatestWithNonce = lastSubmittedTxWithCurrentNonce
&& lastSubmittedTxWithCurrentNonce.id === transactionId
return isLastSubmittedTxWithCurrentNonce && Date.now() - transactionSubmittedTime > 30000
return currentTxIsLatestWithNonce && Date.now() - submittedTime > 30000
}
TxListItem.prototype.resubmit = function () {