Skip to content

Commit

Permalink
fix: nonce value when there are multiple transactions in parallel (#2…
Browse files Browse the repository at this point in the history
…7874)

## **Description**

Fix issue with nonce not updating when there are multiple transaction
created in parallel and once transaction is submitted.

## **Related issues**

Fixes: #27617

## **Manual testing steps**

1. Go to testdapp
2. create 2 transactions and submit first one
3. Nonce for second transaction should update

## **Screenshots/Recordings**
TODO

## **Pre-merge author checklist**

- [X] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [X] I've completed the PR template to the best of my ability
- [X] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [X] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
jpuri authored Oct 15, 2024
1 parent cd820ef commit cc47ff9
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ export default class ConfirmTransactionBase extends Component {
useMaxValue,
hasPriorityApprovalRequest,
mostRecentOverviewPage,
txData,
getNextNonce,
} = this.props;

const {
Expand All @@ -225,13 +227,18 @@ export default class ConfirmTransactionBase extends Component {
isEthGasPriceFetched: prevIsEthGasPriceFetched,
hexMaximumTransactionFee: prevHexMaximumTransactionFee,
hasPriorityApprovalRequest: prevHasPriorityApprovalRequest,
txData: prevTxData,
} = prevProps;

const statusUpdated = transactionStatus !== prevTxStatus;
const txDroppedOrConfirmed =
transactionStatus === TransactionStatus.dropped ||
transactionStatus === TransactionStatus.confirmed;

if (txData.id !== prevTxData.id) {
getNextNonce();
}

if (
nextNonce !== prevNextNonce ||
customNonceValue !== prevCustomNonceValue
Expand Down

0 comments on commit cc47ff9

Please sign in to comment.