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
fix: reduce re-renders in account overview tabs (#37358)
## **Description**
The `useAssetListTokenDetection` hook causes unnecessary re-renders in
Account Overview Tabs, cascading down the component tree
This PR extracts this hook
[](https://codespaces.new/MetaMask/metamask-extension/pull/37358?quickstart=1)
## **Changelog**
CHANGELOG entry: null
## **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**
```
{name: 'AccountOverviewTabs', renders: 1, timestamp: '09:15:09'}
{name: 'AccountOverviewTabs', renders: 2, timestamp: '09:15:09'}
{name: 'AccountOverviewTabs', renders: 3, timestamp: '09:15:09'}
{name: 'AccountOverviewTabs', renders: 4, timestamp: '09:15:09'}
{name: 'AccountOverviewTabs', renders: 5, timestamp: '09:15:09'}
{name: 'AccountOverviewTabs', renders: 6, timestamp: '09:15:09'}
```
### **After**
```
{name: 'AccountOverviewTabs', renders: 1, timestamp: '09:26:48'}
{name: 'AccountOverviewTabs', renders: 2, timestamp: '09:26:48'}
```
## **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]
> Extracts token detection hook into a new `AssetListTokenDetection`
component and uses it in `AccountOverviewTabs` to reduce unnecessary
re-renders.
>
> - **Account Overview**:
> - Add `AssetListTokenDetection`
(`ui/components/multichain/account-overview/asset-list-token-detection.tsx`)
to encapsulate `useAssetListTokenDetection`.
> - Update `account-overview-tabs.tsx`:
> - Remove direct `useAssetListTokenDetection` usage; render
`AssetListTokenDetection` above `Tabs` to prevent cascading re-renders.
> - Minor return structure change (wrap with fragment); tab contents and
behavior unchanged.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5b6bf74. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
0 commit comments