Skip to content

Commit

Permalink
fix: Remove unnecessary re renders activity view (#11989)
Browse files Browse the repository at this point in the history
## **Description**

Activity view and every component that uses the selector
`selectAccountsByChainId` was re rendering when the state was [updating
with the same value
](https://github.com/MetaMask/core/blob/c970faff01eae893bc32ae7c7a513fbb31495182/packages/assets-controllers/src/AccountTrackerController.ts#L327).

We should aim to only update the state when there is changes. [Draft
created](MetaMask/core#4837)

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



https://github.com/user-attachments/assets/6871de37-09ee-4452-b2b1-79e0286c1e4c



### **After**

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


https://github.com/user-attachments/assets/eeb62987-d2c0-40d8-aa33-0aefce309e50



## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/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-mobile/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.
  • Loading branch information
tommasini authored Oct 23, 2024
1 parent 67b73a5 commit a5e5110
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/selectors/accountTrackerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const selectAccounts = createDeepEqualSelector(
(accountTrackerControllerState: AccountTrackerControllerState) =>
accountTrackerControllerState.accounts,
);
export const selectAccountsByChainId = createSelector(
export const selectAccountsByChainId = createDeepEqualSelector(
selectAccountTrackerControllerState,
(accountTrackerControllerState: AccountTrackerControllerState) =>
accountTrackerControllerState.accountsByChainId,
Expand Down

0 comments on commit a5e5110

Please sign in to comment.