Skip to content

Conversation

@vinnyhoward
Copy link
Contributor

@vinnyhoward vinnyhoward commented Nov 11, 2025

Description

This is the first in a series of PRs removing the MM_REMOVE_GLOBAL_NETWORK_SELECTOR feature flag.
Master PR for reference: #22067

This PR removes the feature flag from polling hooks and their tests. The polling hooks (useTokenRatesPolling and useTokenListPolling) already use usePollingNetworks(), which relies on NetworkEnablementController to determine which networks to poll. The tests were updated to:

  • Remove all isRemoveGlobalNetworkSelectorEnabled feature flag mocks
  • Remove obsolete tests that covered the old behavior (when the flag was OFF)
  • Update test states to include NetworkEnablementController configuration
  • Rename test describe blocks from "Feature flag scenarios" to "Network enablement scenarios"

Files Changed:

app/components/hooks/AssetPolling/useTokenRatesPolling.test.ts - Removed feature flag mocks, updated tests to use NetworkEnablementController state
app/components/hooks/AssetPolling/useTokenListPolling.test.ts - Removed feature flag mocks, updated tests to use NetworkEnablementController state

Behavior Change:

The default behavior is now equivalent to the feature flag being ON. Polling hooks poll enabled EVM networks based on NetworkEnablementController.enabledNetworkMap instead of using the feature flag to determine behavior.

Changelog

CHANGELOG entry: Removed MM_REMOVE_GLOBAL_NETWORK_SELECTOR feature flag from asset polling hooks. Polling now uses NetworkEnablementController state to determine which networks to poll.

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-195

Manual testing steps

Feature: Asset polling hooks without feature flag

  Scenario: Verify polling works correctly with NetworkEnablementController

    Given the app is running
    And multiple EVM networks are configured with some enabled and some disabled

    When the app loads and polling hooks initialize

    Then token rates polling should only poll enabled networks
    And token list polling should only poll enabled networks
    And disabled networks should not be polled
    And all unit tests pass

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.

Note

Removes isRemoveGlobalNetworkSelectorEnabled usage across Wallet, selectors, and polling hooks, standardizing behavior to use NetworkEnablementController-driven enabled networks and updating tests/snapshots accordingly.

  • Wallet (app/components/Views/Wallet):
    • Remove isRemoveGlobalNetworkSelectorEnabled references; always show NftGrid when collectiblesEnabled.
    • Simplify testnet checks (enabledNetworksHasTestNet) to use enabled EVM networks directly.
    • In handleNetworkFilter, call selectNetwork(chainId) when no enabled EVM networks (without flag gating).
    • Tests: drop feature-flag mocks; add "Network Manager Integration" cases using NetworkEnablementController; snapshots updated.
  • Asset Polling:
    • use-polling-networks: remove flag logic; return configs for enabled EVM networks when EVM selected.
    • Tests (useAccountTrackerPolling, useCurrencyRatePolling, useTokenDetectionPolling, useTokenListPolling, useTokenRatesPolling): remove flag mocks and obsolete cases; assert polling only for enabled/popular networks; add NetworkEnablementController state; ensure no polling when EVM not selected; unmount cleanup expectations.
  • Selectors (app/selectors/multichain/evm.ts):
    • Remove flag-based branches; filter tokens by enabledNetworksByNamespace[EIP-155] when available, otherwise fall back to current-network/all-networks behavior.
    • Keep testnet filtering independent of the flag.
    • Tests updated to validate enabled-network filtering and fallbacks.
  • Snapshots:
    • Update error text assertions in Wallet error boundary (...reading 'isNftFetchingProgress').

Written by Cursor Bugbot for commit 328bfa3. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

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.

@metamaskbot metamaskbot added the team-mobile-ux Mobile UX team label Nov 11, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.91%. Comparing base (dddee92) to head (2130d6a).
⚠️ Report is 42 commits behind head on main.

Files with missing lines Patch % Lines
app/selectors/multichain/evm.ts 66.66% 0 Missing and 2 partials ⚠️
app/components/Views/Wallet/index.tsx 66.66% 0 Missing and 1 partial ⚠️
...ponents/hooks/AssetPolling/use-polling-networks.ts 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22463      +/-   ##
==========================================
+ Coverage   77.86%   77.91%   +0.05%     
==========================================
  Files        3826     3831       +5     
  Lines       98105    98007      -98     
  Branches    19236    19239       +3     
==========================================
- Hits        76389    76363      -26     
+ Misses      16480    16397      -83     
- Partials     5236     5247      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants