-
Notifications
You must be signed in to change notification settings - Fork 5.4k
release(runway): cherry-pick fix: cp-13.10.1 prevent account list from fetching list of all accounts balances #38098
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
release(runway): cherry-pick fix: cp-13.10.1 prevent account list from fetching list of all accounts balances #38098
Conversation
…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? --> [](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 -->
|
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. |
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: 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
metamask-extension/ui/hooks/useAssetsUpdateAllAccountBalances.test.ts
Lines 60 to 76 in 6236adc
| 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, |
Builds ready [6236adc]
UI Startup Metrics (1237 ± 92 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
|
|
No release label on PR. Adding release label release-13.10.1 on PR, as PR was cherry-picked in branch 13.10.1. |
Description
prevent token list from fetching balances for all accounts
Changelog
CHANGELOG entry: prevent token list from fetching balances for all
accounts
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Docs and MetaMask
Extension Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Note
Pass
platform: 'extension'toTokenBalancesControllerand switch the hook’supdateBalancesFoAccountsflag tofalse, updating tests accordingly.TokenBalancesControllerInitnow passesplatform: 'extension'when constructingTokenBalancesController.platform: 'extension'is provided.useAssetsUpdateAllAccountBalancesswitchesupdateBalancesFoAccounts(enabledChainIds, false)(fromtrue).Written by Cursor Bugbot for commit 6236adc. This will update automatically on new commits. Configure here.
b5eaa85