diff options
author | Dan J Miller <danjm.com@gmail.com> | 2018-07-26 10:12:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-26 10:12:49 +0800 |
commit | 53b440a2878cea6b97c42e9cc7969eabd3431f27 (patch) | |
tree | 810891380f2fea1b96fc6b91bd6c7137986aecfd /ui/app | |
parent | acddb85f2ec1bd8c005377d098d9597d0eba294a (diff) | |
parent | b580f60d749b862fe08adfc7457c726905ebc623 (diff) | |
download | tangerine-wallet-browser-53b440a2878cea6b97c42e9cc7969eabd3431f27.tar tangerine-wallet-browser-53b440a2878cea6b97c42e9cc7969eabd3431f27.tar.gz tangerine-wallet-browser-53b440a2878cea6b97c42e9cc7969eabd3431f27.tar.bz2 tangerine-wallet-browser-53b440a2878cea6b97c42e9cc7969eabd3431f27.tar.lz tangerine-wallet-browser-53b440a2878cea6b97c42e9cc7969eabd3431f27.tar.xz tangerine-wallet-browser-53b440a2878cea6b97c42e9cc7969eabd3431f27.tar.zst tangerine-wallet-browser-53b440a2878cea6b97c42e9cc7969eabd3431f27.zip |
Merge pull request #4885 from MetaMask/RetryOnEarliestPendingTx
Only show retry button on the earliest pending tx
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/components/tx-list-item.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js index 0d693b805..1a639d0b9 100644 --- a/ui/app/components/tx-list-item.js +++ b/ui/app/components/tx-list-item.js @@ -213,14 +213,23 @@ 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') + const currentSubmittedTxs = selectedAddressTxList.filter(tx => tx.status === 'submitted') const lastSubmittedTxWithCurrentNonce = currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1] const currentTxIsLatestWithNonce = lastSubmittedTxWithCurrentNonce && lastSubmittedTxWithCurrentNonce.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 + return currentTxIsLatestWithNonce && Date.now() - transactionSubmittedTime > 30000 && currentTxIsLatest } TxListItem.prototype.setSelectedToken = function (tokenAddress) { |