Skip to content

Conversation

@runway-github
Copy link
Contributor

@runway-github runway-github bot commented Nov 21, 2025

Description

prevent token list from fetching balances for all accounts

Open in GitHub Codespaces

Changelog

CHANGELOG entry: prevent token list from fetching balances for all
accounts

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.

Note

Pass platform: 'extension' to TokenBalancesController and switch the hook’s updateBalancesFoAccounts flag to false, updating tests accordingly.

  • Controllers:
    • TokenBalancesControllerInit now passes platform: 'extension' when constructing TokenBalancesController.
    • Updated test to assert platform: 'extension' is provided.
  • UI Hooks:
    • useAssetsUpdateAllAccountBalances switches updateBalancesFoAccounts(enabledChainIds, false) (from true).
    • Updated related tests to expect the new boolean argument and re-render behavior.

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

b5eaa85

…m fetching list of all accounts balances (#38065)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

prevent token list from fetching balances for all accounts

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/38065?quickstart=1)

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: prevent token list from fetching balances for all
accounts

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Switches balance updates to use the non-all-accounts path and passes
`platform: 'extension'` when initializing `TokenBalancesController`.
> 
> - **Assets/Hooks**
> - `useAssetsUpdateAllAccountBalances`: calls
`updateBalancesFoAccounts(enabledChainIds, false)` instead of `true`.
>   - Tests updated to expect the new boolean flag where applicable.
> - **Controller Init**
> - `TokenBalancesControllerInit`: passes `platform: 'extension'` to
`TokenBalancesController`.
>   - Corresponding test updated to assert the `platform` argument.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e7ecafd. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@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-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Nov 21, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Test expectations inconsistent with implementation change

The test "should call updateBalancesFoAccounts when enabledChainIds are available" still expects updateBalancesFoAccounts to be called with true as the second parameter, but the implementation was changed to pass false. The diff updated some tests (in the "should run effect again when enabledChainIds change" test) but missed this and other tests that verify the same code path, causing them to fail when run.

ui/hooks/useAssetsUpdateAllAccountBalances.test.ts#L60-L76

it('should call updateBalancesFoAccounts when enabledChainIds are available', () => {
const mockChainIds = ['0x1', '0x89'];
mockUseSelector.mockImplementation((selector) => {
if (selector === getEnabledChainIds) {
return mockChainIds;
}
return undefined;
});
renderHook(() => useAssetsUpdateAllAccountBalances());
expect(mockDispatch).toHaveBeenCalledWith(
mockUpdateBalancesFoAccounts(mockChainIds, true),
);
expect(mockUpdateBalancesFoAccounts).toHaveBeenCalledWith(
mockChainIds,

Fix in Cursor Fix in Web


@metamaskbot
Copy link
Collaborator

Builds ready [6236adc]
UI Startup Metrics (1237 ± 92 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1237107214559212911409
load106792712688411211226
domContentLoaded106092212628311161219
domInteractive2314100172071
firstPaint63787127142510791189
backgroundConnect23322128310235254
firstReactRender26206662736
getState21972112340
initialActions103112
loadScripts834702103682892982
setupStore1062631115
numNetworkReqs1367419670
BrowserifyPower User HomeuiStartup19701707290230521322902
load1091919166122013101661
domContentLoaded1080909164521813021645
domInteractive48161564599156
firstPaint715151165152313081651
backgroundConnect24322930016244300
firstReactRender55448185881
getState21115835252243352
initialActions104114
loadScripts850691136820810671368
setupStore221343103343
numNetworkReqs956518444157184
WebpackStandard HomeuiStartup84871712201028481098
load618562101587609848
domContentLoaded61155598182604836
domInteractive181280141554
firstPaint220621022205210729
backgroundConnect251170142664
firstReactRender3419270273641
getState1163951317
initialActions102011
loadScripts60855297080602825
setupStore1162541318
numNetworkReqs1367419872
WebpackPower User HomeuiStartup1062897162525113291625
load665570961142796961
domContentLoaded643559913125782913
domInteractive35131193890119
firstPaint30662966307567966
backgroundConnect58102076577207
firstReactRender39374223942
getState1399115921152159
initialActions101011
loadScripts639557902121771902
setupStore86203820
numNetworkReqs765712324102123
FirefoxBrowserifyStandard HomeuiStartup14531302200612815021723
load1224111216989512621425
domContentLoaded1223111216989512621425
domInteractive50331853152143
firstPaint------
backgroundConnect3925100144765
firstReactRender27226872742
getState1073841019
initialActions203123
loadScripts1200109316699112341403
setupStore13683111232
numNetworkReqs1266215857
BrowserifyPower User HomeuiStartup29202252417065437294170
load14681296190819316721908
domContentLoaded14681295190819416721908
domInteractive20177488125347488
firstPaint------
backgroundConnect41251127746311021277
firstReactRender78621231789123
getState19693606155166606
initialActions214124
loadScripts14131243185418116051854
setupStore13723581165145581
numNetworkReqs1136025176240251
WebpackStandard HomeuiStartup16021384228316816152053
load13541197179912113851648
domContentLoaded13541196179912113851648
domInteractive55291633163122
firstPaint------
backgroundConnect46251552351106
firstReactRender33258493546
getState147200221231
initialActions103122
loadScripts13251180177311313611576
setupStore16791161252
numNetworkReqs1366817764
WebpackPower User HomeuiStartup28932285399846631893998
load15791405187613016821876
domContentLoaded15781405187613016811876
domInteractive1656740597211405
firstPaint------
backgroundConnect25981999278355999
firstReactRender68451041476104
getState16112426542202265
initialActions213133
loadScripts15401376179411916411794
setupStore19234672202177672
numNetworkReqs1135326369177263
📊 Page Load Benchmark Results

Current Commit: 6236adc | Date: 11/21/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±72ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 738ms (±68ms) 🟢 | historical mean value: 728ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±13ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 72ms 1.01s 1.33s 1.28s 1.33s
domContentLoaded 738ms 68ms 698ms 1.01s 941ms 1.01s
firstPaint 77ms 13ms 60ms 188ms 88ms 188ms
firstContentfulPaint 77ms 13ms 60ms 188ms 88ms 188ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

@gauthierpetetin gauthierpetetin merged commit e377454 into release/13.10.1 Nov 21, 2025
173 of 174 checks passed
@gauthierpetetin gauthierpetetin deleted the runway-cherry-pick-13.10.1-1763717696 branch November 21, 2025 10:10
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2025
@metamaskbot metamaskbot added the release-13.10.1 Issue or pull request that will be included in release 13.10.1 label Nov 21, 2025
@metamaskbot
Copy link
Collaborator

No release label on PR. Adding release label release-13.10.1 on PR, as PR was cherry-picked in branch 13.10.1.

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

Labels

release-13.10.1 Issue or pull request that will be included in release 13.10.1 team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants