diff options
author | Dan J Miller <danjm.com@gmail.com> | 2018-08-01 10:34:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 10:34:27 +0800 |
commit | 6ccc34cb52d52c449e3233aaf2a85be70c4f58da (patch) | |
tree | d95ce311b00658e8db1a8982b8b0545d2696aa0c | |
parent | 4f02726fd9a2b7509dfd00eb4b23d9fc81eb5dcd (diff) | |
parent | 0ff0a9c1976d726cb18379e3ac06a8677c928659 (diff) | |
download | tangerine-wallet-browser-6ccc34cb52d52c449e3233aaf2a85be70c4f58da.tar tangerine-wallet-browser-6ccc34cb52d52c449e3233aaf2a85be70c4f58da.tar.gz tangerine-wallet-browser-6ccc34cb52d52c449e3233aaf2a85be70c4f58da.tar.bz2 tangerine-wallet-browser-6ccc34cb52d52c449e3233aaf2a85be70c4f58da.tar.lz tangerine-wallet-browser-6ccc34cb52d52c449e3233aaf2a85be70c4f58da.tar.xz tangerine-wallet-browser-6ccc34cb52d52c449e3233aaf2a85be70c4f58da.tar.zst tangerine-wallet-browser-6ccc34cb52d52c449e3233aaf2a85be70c4f58da.zip |
Merge pull request #4926 from MetaMask/update-logic-for-retry-button
Show the retry button on latest tx of earliest nonce.
-rw-r--r-- | old-ui/app/components/transaction-list-item.js | 8 | ||||
-rw-r--r-- | ui/app/components/tx-list-item.js | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/old-ui/app/components/transaction-list-item.js b/old-ui/app/components/transaction-list-item.js index f479ce666..015ef6ba6 100644 --- a/old-ui/app/components/transaction-list-item.js +++ b/old-ui/app/components/transaction-list-item.js @@ -36,7 +36,7 @@ TransactionListItem.prototype.showRetryButton = function () { return false } - let currentTxIsLatest = false + let currentTxSharesEarliestNonce = false const currentNonce = txParams.nonce const currentNonceTxs = transactions.filter(tx => tx.txParams.nonce === currentNonce) const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted') @@ -45,14 +45,14 @@ TransactionListItem.prototype.showRetryButton = function () { const currentTxIsLatestWithNonce = lastSubmittedTxWithCurrentNonce && lastSubmittedTxWithCurrentNonce.id === transaction.id if (currentSubmittedTxs.length > 0) { - const lastTx = currentSubmittedTxs.reduce((tx1, tx2) => { + const earliestSubmitted = currentSubmittedTxs.reduce((tx1, tx2) => { if (tx1.submittedTime < tx2.submittedTime) return tx1 return tx2 }) - currentTxIsLatest = lastTx.id === transaction.id + currentTxSharesEarliestNonce = currentNonce === earliestSubmitted.txParams.nonce } - return currentTxIsLatestWithNonce && Date.now() - submittedTime > 30000 && currentTxIsLatest + return currentTxSharesEarliestNonce && currentTxIsLatestWithNonce && Date.now() - submittedTime > 30000 } TransactionListItem.prototype.render = function () { diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js index 1a639d0b9..7513ba267 100644 --- a/ui/app/components/tx-list-item.js +++ b/ui/app/components/tx-list-item.js @@ -213,7 +213,7 @@ TxListItem.prototype.showRetryButton = function () { if (!txParams) { return false } - let currentTxIsLatest = false + let currentTxSharesEarliestNonce = false const currentNonce = txParams.nonce const currentNonceTxs = selectedAddressTxList.filter(tx => tx.txParams.nonce === currentNonce) const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted') @@ -222,14 +222,14 @@ TxListItem.prototype.showRetryButton = function () { const currentTxIsLatestWithNonce = lastSubmittedTxWithCurrentNonce && lastSubmittedTxWithCurrentNonce.id === transactionId if (currentSubmittedTxs.length > 0) { - const lastTx = currentSubmittedTxs.reduce((tx1, tx2) => { + const earliestSubmitted = currentSubmittedTxs.reduce((tx1, tx2) => { if (tx1.submittedTime < tx2.submittedTime) return tx1 return tx2 }) - currentTxIsLatest = lastTx.id === transactionId + currentTxSharesEarliestNonce = currentNonce === earliestSubmitted.txParams.nonce } - return currentTxIsLatestWithNonce && Date.now() - transactionSubmittedTime > 30000 && currentTxIsLatest + return currentTxSharesEarliestNonce && currentTxIsLatestWithNonce && Date.now() - transactionSubmittedTime > 30000 } TxListItem.prototype.setSelectedToken = function (tokenAddress) { |