-
Couldn't load subscription status.
- Fork 5.4k
fix: enable networks automatically when added to fix token detection #36102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: enable networks automatically when added to fix token detection #36102
Conversation
|
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. |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [9d8d92f]
UI Startup Metrics (1256 ± 74 ms)
Benchmark value 1089 exceeds gate value 1070 for chrome browserify home mean load Benchmark value 1082 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 253 exceeds gate value 10 for chrome browserify home mean backgroundConnect Benchmark value 25 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 837 exceeds gate value 830 for chrome browserify home mean loadScripts Benchmark value 1405 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 1238 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1231 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 1235 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 264 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 11 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 995 exceeds gate value 940 for chrome browserify home p95 loadScripts Benchmark value 20 exceeds gate value 17 for chrome browserify home p95 setupStore Benchmark value 15 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 36 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 3 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 12 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 234 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 96 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 8 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 38 exceeds gate value 27 for firefox browserify home p95 setupStore Benchmark value 103 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 31 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 3 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 287 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 55 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 5 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 352ms | Sum of p95 exceeds: 736.8ms Sum of all benchmark exceeds: 1088.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [7ab67db]
UI Startup Metrics (1185 ± 61 ms)
Benchmark value 26 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 6 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 223 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 34 exceeds gate value 33 for chrome browserify home p95 getState Benchmark value 18 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 19 exceeds gate value 17 for chrome browserify home p95 setupStore Benchmark value 15 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 1521 exceeds gate value 1405 for firefox browserify home mean uiStartup Benchmark value 1313 exceeds gate value 1245 for firefox browserify home mean load Benchmark value 1312 exceeds gate value 1239 for firefox browserify home mean domContentLoaded Benchmark value 115 exceeds gate value 110 for firefox browserify home mean domInteractive Benchmark value 42 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 30 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 1279 exceeds gate value 1230 for firefox browserify home mean loadScripts Benchmark value 11 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 1943 exceeds gate value 1660 for firefox browserify home p95 uiStartup Benchmark value 255 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 112 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 9 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 1651 exceeds gate value 1615 for firefox webpack home mean uiStartup Benchmark value 1411 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1411 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 111 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 35 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 48 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 5 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 1387 exceeds gate value 1360 for firefox webpack home mean loadScripts Benchmark value 291 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 57 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 5 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 707ms | Sum of p95 exceeds: 769.8ms Sum of all benchmark exceeds: 1476.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [c0b965b]
UI Startup Metrics (1193 ± 63 ms)
Benchmark value 26 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 223 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 13 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 16 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 33 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 28 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 12 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 240 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 72 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 10 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 1649 exceeds gate value 1615 for firefox webpack home mean uiStartup Benchmark value 1407 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1406 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 110 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 31 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 47 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 7 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 1384 exceeds gate value 1360 for firefox webpack home mean loadScripts Benchmark value 1676 exceeds gate value 1660 for firefox webpack home p95 load Benchmark value 1675 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded Benchmark value 305 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 54 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 6 exceeds gate value 2 for firefox webpack home p95 initialActions Benchmark value 1654 exceeds gate value 1630 for firefox webpack home p95 loadScripts Sum of mean exceeds: 367ms | Sum of p95 exceeds: 492.8ms Sum of all benchmark exceeds: 859.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
This commit introduces functionality to enable networks when the `NetworkController:networkAdded` event is emitted. It updates the `NetworkOrderController` to handle both EVM and non-EVM networks, ensuring that the state reflects the newly added networks correctly. Additionally, tests have been added to verify the expected behavior upon receiving network addition events.
…erMessenger This commit updates the NetworkOrderControllerMessenger to handle the 'NetworkController:networkAdded' event, allowing the application to respond appropriately when new networks are added. The allowed events list has been modified to include this new event, ensuring that the state reflects changes in network availability. This enhancement improves the overall functionality of the network management system.
…aming changes This commit modifies the test for `getNetworkOrderControllerMessenger` to use the correct variable name `networkOrderControllerMessenger` instead of `nftControllerMessenger`. This change ensures clarity and consistency in the test code, aligning with the recent updates in the messenger implementation.
…tworks This commit updates the NetworkOrderController to differentiate between featured networks and custom networks when the 'NetworkController:networkAdded' event is emitted. It modifies the state management logic to enable featured networks while ensuring that only custom networks are enabled when added, disabling all others. Additionally, the corresponding test cases have been updated to reflect these changes, ensuring accurate coverage of the new functionality.
This commit refines the switch network test by removing redundant checks for the Localhost 8545 network and consolidating the Arbitrum network addition into a single step. This enhances test clarity and efficiency while ensuring the local node balance is verified after the network switch.
53a8d45 to
6b0163a
Compare
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [6b0163a]
UI Startup Metrics (1206 ± 66 ms)
Benchmark value 26 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 16 exceeds gate value 15 for chrome browserify home mean getState Benchmark value 6 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 225 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 15 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 18 exceeds gate value 17 for chrome browserify home p95 setupStore Benchmark value 18 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 1412 exceeds gate value 1405 for firefox browserify home mean uiStartup Benchmark value 33 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 30 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 12 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 1687 exceeds gate value 1660 for firefox browserify home p95 uiStartup Benchmark value 267 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 72 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 29 exceeds gate value 24 for firefox browserify home p95 getState Benchmark value 7 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 35 exceeds gate value 27 for firefox browserify home p95 setupStore Benchmark value 1684 exceeds gate value 1615 for firefox webpack home mean uiStartup Benchmark value 1433 exceeds gate value 1380 for firefox webpack home mean load Benchmark value 1432 exceeds gate value 1380 for firefox webpack home mean domContentLoaded Benchmark value 114 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 35 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 49 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 6 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 1408 exceeds gate value 1360 for firefox webpack home mean loadScripts Benchmark value 2075 exceeds gate value 1935 for firefox webpack home p95 uiStartup Benchmark value 1707 exceeds gate value 1660 for firefox webpack home p95 load Benchmark value 1707 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded Benchmark value 287 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 51 exceeds gate value 49 for firefox webpack home p95 backgroundConnect Benchmark value 60 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 7 exceeds gate value 2 for firefox webpack home p95 initialActions Benchmark value 1683 exceeds gate value 1630 for firefox webpack home p95 loadScripts Sum of mean exceeds: 501ms | Sum of p95 exceeds: 786.8ms Sum of all benchmark exceeds: 1287.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
This commit modifies the switch network test to replace checks for local node balances with assertions for expected balances in both ETH and USD. This change enhances the clarity of the test by ensuring it verifies the correct balance display after switching networks, improving overall test accuracy and maintainability.
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [b011c80]
UI Startup Metrics (1205 ± 70 ms)
Benchmark value 29 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 16 exceeds gate value 15 for chrome browserify home mean getState Benchmark value 6 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 227 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 34 exceeds gate value 33 for chrome browserify home p95 getState Benchmark value 15 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 18 exceeds gate value 17 for chrome browserify home p95 setupStore Benchmark value 14 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 34 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 29 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 5 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 11 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 1666 exceeds gate value 1660 for firefox browserify home p95 uiStartup Benchmark value 210 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 89 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 10 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 37 exceeds gate value 27 for firefox browserify home p95 setupStore Benchmark value 104 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 32 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 284 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 52 exceeds gate value 50 for firefox webpack home p95 firstReactRender Benchmark value 7 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 255ms | Sum of p95 exceeds: 424.8ms Sum of all benchmark exceeds: 679.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| state.enabledNetworkMap[namespace][caipId] = true; | ||
| }); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Network Map Access and Type Mismatch
In onNetworkAdded, accessing state.enabledNetworkMap[namespace] without ensuring the namespace key exists can cause a TypeError when adding new or uninitialized network namespaces. Additionally, the networkId parameter is typed as Hex but also handles CAIP chain IDs, which is inaccurate.
Description
What is the reason for the change?
When a user adds a new network (e.g., Polygon) and immediately navigates to Swap → Token Picker, the token list shows infinite loading because networks are added to
networkConfigurationsByChainIdbut NOT automatically enabled inenabledNetworkMap. This prevents token detection polling hooks from triggering.What is the improvement/solution?
Implemented event-driven network enabling in
NetworkOrderControllerto automatically enable newly added networks, triggering token detection and resolving the infinite loading issue.Changelog
CHANGELOG entry: Fixed token list infinite loading when adding new networks by automatically enabling networks for token detection.
Related issues
Fixes: #35910, ASSETS-1221
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist