Skip to content

Conversation

@sahar-fehri
Copy link
Contributor

Description

When clicking on an EVM network from the dapp connected site popover (the network button shown when a dapp is connected), the network would not switch on the home page. However, selecting a non-EVM network from the same menu would correctly switch the network.

Looking at the code, the intention was clearly for EVM networks to switch when selected - the handleEvmNetworkChange function calls setActiveNetwork(finalNetworkClientId) which should update the globally selected network. However, this was silently failing.

Non-EVM networks worked correctly because handleNonEvmNetworkChange does not have the dapp-specific code block that calls setNetworkClientIdForDomain. It simply calls setActiveNetwork(chainId) directly without going through the problematic code path

Changelog

CHANGELOG entry: Fixing a bug to allow switching evm networks on main page when selected from dapp connected site popover.

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Jan 7, 2026

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/core-extension-ux (1 files, +4 -3)
  • 📁 ui/
    • 📁 components/
      • 📁 multichain/
        • 📁 network-list-menu/
          • 📄 network-list-menu.tsx +4 -3


dispatch(
setNetworkClientIdForDomain(selectedTabOrigin, finalNetworkClientId),
await setNetworkClientIdForDomain(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setNetworkClientIdForDomain returns a Promise, not a Redux thunk. The code was incorrectly wrapping this function call with dispatch():
This caused the execution to fail silently, preventing setActiveNetwork from being reached.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find! That does look like it's fixed it. Though I think the part that filters the global network menu is setEnabledNetworks not setActiveNetwork, right? Not totally sure what setActiveNetwork is supposed to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the setActiveNetwork is what switches the network; it calls the networkController.
The setEnabledNetworks; controls which networks appear in the network list UI
Just updates enabledNetworkMap state and it calls the networkEnablementController

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Jan 7, 2026

Builds ready [9880904]
UI Startup Metrics (1273 ± 107 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12731035158910713331455
load107186713649511331235
domContentLoaded106586513409411281227
domInteractive251597192280
firstPaint177641353192188318
backgroundConnect21519824211222237
firstReactRender1593541723
getState361868114160
initialActions105113
loadScripts8586611121949161013
setupStore1273851422
numNetworkReqs171175171169
BrowserifyPower User HomeuiStartup17381408209016118132050
load1057885134110411281217
domContentLoaded1045873132710211151209
domInteractive2917110212692
firstPaint171741336165207327
backgroundConnect24520155662251428
firstReactRender14112121519
getState17712831236196247
initialActions104112
loadScripts826668110998898990
setupStore196156172643
numNetworkReqs65431271663112
WebpackStandard HomeuiStartup792650101880848949
load64457885168692780
domContentLoaded63957384667687774
domInteractive251696182179
firstPaint996128245113205
backgroundConnect2751203133103
firstReactRender1593441623
getState321584144161
initialActions103112
loadScripts63657084466684767
setupStore1254271336
numNetworkReqs171175171170
WebpackPower User HomeuiStartup1164917174115412281575
load73360298094827900
domContentLoaded72659597293820893
domInteractive32171292627104
firstPaint1396538269194287
backgroundConnect51757611239437
firstReactRender15132111618
getState14111921015146177
initialActions102111
loadScripts72359297092816890
setupStore14104271338
numNetworkReqs65521321961119
FirefoxBrowserifyStandard HomeuiStartup13881092193516515011756
load1120911169512812071336
domContentLoaded1119911169512812061335
domInteractive753323846102155
firstPaint------
backgroundConnect59212845158167
firstReactRender13106461321
getState1163651222
initialActions102012
loadScripts1081896167110611521222
setupStore134132151137
numNetworkReqs19987191375
BrowserifyPower User HomeuiStartup25311461328452429373197
load1709972257254921872474
domContentLoaded1708971257254821862474
domInteractive69333305468195
firstPaint------
backgroundConnect3961912014289751145
firstReactRender20115782428
getState1096097593121173
initialActions208123
loadScripts1384958241345519582282
setupStore314103710519101
numNetworkReqs74531522982147
WebpackStandard HomeuiStartup16011325221021317282079
load13361108192715014171661
domContentLoaded13361108192715014171661
domInteractive802821042111142
firstPaint------
backgroundConnect60201893978147
firstReactRender15116561521
getState186209261554
initialActions103122
loadScripts12991094181513113681616
setupStore175216261343
numNetworkReqs19990191372
WebpackPower User HomeuiStartup27861713389156831903537
load21161176300755225462753
domContentLoaded21151176300755225452753
domInteractive8031111112076202
firstPaint------
backgroundConnect3902012704024111212
firstReactRender19135872227
getState113621026100118202
initialActions208122
loadScripts18091158298749722652568
setupStore31599310316104
numNetworkReqs73501723080146
📊 Page Load Benchmark Results

Current Commit: 9880904 | Date: 1/7/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±39ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 725ms (±36ms) 🟢 | historical mean value: 726ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±12ms) 🟢 | historical mean value: 77ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 39ms 1.01s 1.33s 1.07s 1.33s
domContentLoaded 725ms 36ms 702ms 993ms 740ms 993ms
firstPaint 76ms 12ms 60ms 180ms 84ms 180ms
firstContentfulPaint 76ms 12ms 60ms 180ms 84ms 180ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 7.82 KiB (0.16%)
  • ui: -4.51 KiB (-0.06%)
  • common: -3.98 KiB (-0.04%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants