Skip to content

Commit

Permalink
feat: bump @metamask/queued-request controller to ^2.0.0 to fix c…
Browse files Browse the repository at this point in the history
…onfirmation popup focus in request queue (#25497)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25497?quickstart=1)

## **Related issues**

See: MetaMask/core#4457
See: #25397

## **Manual testing steps**

1. Ensure request queue is toggled on
2. In Tab 1, Visit the test dapp
3. run `await window.ethereum.request({method:
'wallet_switchEthereumChain', params: [{"chainId": "0xaa36a7"}]})` in
console to change the network to sepolia for this dapp
4. In Tab 2, Visit a different dapp
5. run `await window.ethereum.request({method:
'wallet_switchEthereumChain', params: [{"chainId": "1"}]})` in console
to change the network to mainnet for this dapp
6. In Tab 1, click the Send Transaction button, but ignore the
confirmation notification (leave it open)
7. In Tab 2, run `await window.ethereum.request({method:
'eth_requestAccounts'})`
8. The confirmation notification window should be focused and visible
now, but still be displaying the pending transaction from before

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**


https://github.com/MetaMask/metamask-extension/assets/918701/48693083-fe60-402f-8798-c32b5db541b6

## **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
- [ ] I’ve included tests if applicable
- [x] 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
jiexi committed Jun 25, 2024
1 parent 78fb6ec commit e5d4809
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ export default class MetamaskController extends EventEmitter {
shouldRequestSwitchNetwork: ({ method }) =>
methodsRequiringNetworkSwitch.includes(method),
clearPendingConfirmations,
showApprovalRequest: opts.showUserConfirmation,
});

this.approvalController = new ApprovalController({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
"@metamask/post-message-stream": "^8.0.0",
"@metamask/ppom-validator": "^0.30.0",
"@metamask/providers": "^14.0.2",
"@metamask/queued-request-controller": "^1.0.0",
"@metamask/queued-request-controller": "^2.0.0",
"@metamask/rate-limit-controller": "^5.0.1",
"@metamask/safe-event-emitter": "^3.1.1",
"@metamask/scure-bip39": "^2.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('Request Queuing Dapp 1 Send Tx -> Dapp 2 Request Accounts Tx', functio
assert.deepStrictEqual(accountsBeforeConnect, '');

// Reject the pending confirmation from the first dapp
await switchToNotificationWindow(driver);
await switchToNotificationWindow(driver, 4);
await driver.clickElement({ text: 'Reject', tag: 'button' });

// Wait for switch confirmation to close then request accounts confirmation to show for the second dapp
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6086,9 +6086,9 @@ __metadata:
languageName: node
linkType: hard

"@metamask/queued-request-controller@npm:^1.0.0":
version: 1.0.0
resolution: "@metamask/queued-request-controller@npm:1.0.0"
"@metamask/queued-request-controller@npm:^2.0.0":
version: 2.0.0
resolution: "@metamask/queued-request-controller@npm:2.0.0"
dependencies:
"@metamask/base-controller": "npm:^6.0.0"
"@metamask/controller-utils": "npm:^11.0.0"
Expand All @@ -6099,7 +6099,7 @@ __metadata:
peerDependencies:
"@metamask/network-controller": ^19.0.0
"@metamask/selected-network-controller": ^15.0.0
checksum: 10/84b5442035ef4843ad5c3effdb961c9725c07fa3caf37928c4315ffb4929160a1032b8e0f814061fa8487f499d147766f3cfdd4172c8a3941c2996b11628a46b
checksum: 10/b618fa05465a52e5b689d932d99b47552b5987a9141d58260966611f1057190132f14b1a2123c48399f218fc57c577e1c86375e8ee2b43871cdc597fbaeedb7a
languageName: node
linkType: hard

Expand Down Expand Up @@ -25092,7 +25092,7 @@ __metadata:
"@metamask/post-message-stream": "npm:^8.0.0"
"@metamask/ppom-validator": "npm:^0.30.0"
"@metamask/providers": "npm:^14.0.2"
"@metamask/queued-request-controller": "npm:^1.0.0"
"@metamask/queued-request-controller": "npm:^2.0.0"
"@metamask/rate-limit-controller": "npm:^5.0.1"
"@metamask/safe-event-emitter": "npm:^3.1.1"
"@metamask/scure-bip39": "npm:^2.0.3"
Expand Down

0 comments on commit e5d4809

Please sign in to comment.