MetaMask / MetaMask/metamask-extension

[Bug]: Wallet API - Adding a network from the popup and switching to that network doesn't update dapp network

Open
#32,501 0 comments 0 reactions 0 assignees View on GitHub
needs-triage regression-prod-12.16.1 Sev2-normal team-wallet-api-platform-deprecated type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

Full bug title:
[Bug]: Wallet API - Adding a network from the popup and switching to that network doesn't update dapp network and when I delete that network I get Uncaught Error: NetworkClientId for domain cannot be called with a domain that has not yet been granted permissions

### Describe the bug

Whenever I am connected to a dapp, if I open the popup and I add a new network, I am automatically switched to that network. I can see from the MM popup that I am in the new network.
If I trigger a tx from the dapp, I still see how I am in the old network. I need to close and open the popup again in order for the network change to take effect

### Expected behavior

_No response_

### Screenshots/Recordings

https://github.com/user-attachments/assets/66df6546-b0e6-4e03-8928-1c05b6824527

### Steps to reproduce

1. Go to the test dapp
2. Connect MM
3. Now in the test dapp, click the MM icon
4. Add a new network
5. See how you are switched to that network from the popup
6. Trigger a dapp tx
7. See how this triggers the tx in the old network

### Error messages or log output

```shell

```

### Detection stage

In production (default)

### Version

12.16.1

### Build type

None

### Browser

Chrome

### Operating system

Linux

### Hardware wallet

_No response_

### Additional context

_No response_

### Severity

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the listed test-dapp steps in Chrome on version 12.16.1, and compare the network shown in the popup with the network used when the dapp triggers a transaction. Verify the behavior after adding a network and after deleting it; done means the dapp uses the newly selected network without reopening the popup and deletion does not produce the reported permissions error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.