You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two render-performance optimizations for the assets UI lacked test coverage: useTokenBalances isolation via TokenBalancesPoller and AssetPollingContext value memoization.
Imports AssetPollingContext and AssetPollingContextValue (previously unused in tests)
Adds a memoization test that captures the context value across two renders and asserts referential identity (toBe), confirming the useMemo guard prevents context consumers from re-rendering on every AssetPollingProvider render
Mocks useTokenBalances at the module level — previously the hook ran against the real store, relying on completedOnboarding being falsy to silently skip polling
Adds a TokenBalancesPoller describe block verifying that useTokenBalances is called with the enabled EVM chain IDs from Redux state:
Low Risk
Test-only changes with no production logic modified.
Overview
Adds test-only coverage for two existing assets UI render-performance behaviors.
In account-overview-tabs.test.tsx, useTokenBalances is mocked module-wide with a shared beforeEach default return, and a new TokenBalancesPoller case asserts that rendering AccountOverviewTabs with enabled EVM networks in Redux triggers useTokenBalances with chainIds including mainnet and polygon.
In assetPolling.test.tsx, a context value memoization test re-renders AssetPollingProvider and checks the AssetPollingContext value keeps the same object reference across renders, guarding the useMemo stability behavior.
Reviewed by Cursor Bugbot for commit b5b13e8. Bugbot is set up for automated code reviews on this repo. Configure here.
CopilotAI
changed the title
[WIP] Extract assets side-effect functionality
test: validate TokenBalancesPoller isolation and AssetPollingContext memoization
May 14, 2026
DDDDDanica
changed the title
test: validate TokenBalancesPoller isolation and AssetPollingContext memoization
chore(6918): validate TokenBalancesPoller isolation and AssetPollingContext memoization
Jun 9, 2026
DDDDDanica
changed the title
chore(6918): validate TokenBalancesPoller isolation and AssetPollingContext memoization
chore(6635): validate TokenBalancesPoller isolation and AssetPollingContext memoization
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two render-performance optimizations for the assets UI lacked test coverage:
useTokenBalancesisolation viaTokenBalancesPollerandAssetPollingContextvalue memoization.Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6635
CHANGELOG entry: null
Changes
ui/contexts/assetPolling.test.tsxAssetPollingContextandAssetPollingContextValue(previously unused in tests)toBe), confirming theuseMemoguard prevents context consumers from re-rendering on everyAssetPollingProviderrenderui/components/multichain/account-overview/account-overview-tabs.test.tsxuseTokenBalancesat the module level — previously the hook ran against the real store, relying oncompletedOnboardingbeing falsy to silently skip pollingTokenBalancesPollerdescribe block verifying thatuseTokenBalancesis called with the enabled EVM chain IDs from Redux state:Note
Low Risk
Test-only changes with no production logic modified.
Overview
Adds test-only coverage for two existing assets UI render-performance behaviors.
In
account-overview-tabs.test.tsx,useTokenBalancesis mocked module-wide with a sharedbeforeEachdefault return, and a newTokenBalancesPollercase asserts that renderingAccountOverviewTabswith enabled EVM networks in Redux triggersuseTokenBalanceswithchainIdsincluding mainnet and polygon.In
assetPolling.test.tsx, a context value memoization test re-rendersAssetPollingProviderand checks theAssetPollingContextvalue keeps the same object reference across renders, guarding theuseMemostability behavior.Reviewed by Cursor Bugbot for commit b5b13e8. Bugbot is set up for automated code reviews on this repo. Configure here.