Commit 95e7280
fix(activity): restore Perps after popular networks without forcing Ethereum (#29676)
## **Description**
1. **Reason:** On Activity, the Perps tab is gated by
`selectIsEvmNetworkSelected`. After choosing Solana and then **All
popular networks**, `isEvmSelected` stayed false, so Perps did not
return
([TMCU-672](https://consensyssoftware.atlassian.net/browse/TMCU-672)).
An earlier approach called `selectPopularNetwork('eip155:1')` after
`enableAllPopularNetworks()`, which fixed Perps but incorrectly forced
the global EVM chain to Ethereum mainnet, so the network picker showed
Ethereum instead of aggregate popular networks.
2. **Solution:** Keep `selectAllPopularNetworks` limited to
`NetworkEnablementController.enableAllPopularNetworks()` (no implicit
chain switch). Drive Activity Perps visibility with
**`useNetworksByCustomNamespace`** (`eip155`, popular): show Perps when
the Perps feature flag is on **and** either the user is on EVM
(`isEvmSelected`) **or** all popular EVM networks are enabled—without
changing the active multichain selection.
## **Changelog**
CHANGELOG entry: Fixed the Activity Perps tab not reappearing after
switching the transaction network filter back to popular networks from
Solana, without forcing Ethereum as the selected chain.
## **Related issues**
Fixes #29053
Refs: https://consensyssoftware.atlassian.net/browse/TMCU-672
## **Manual testing steps**
```gherkin
Feature: Activity Perps tab and popular network filter (TMCU-602)
Scenario: Perps returns after Solana then all popular networks without picking Ethereum
Given the Perps feature flag is enabled
And the user is on Activity with the transaction network filter showing popular networks
When the user opens the network picker and selects Solana
Then the Perps tab is hidden
When the user opens the network picker and selects all popular networks
Then the Perps tab is visible again
And the picker does not show Ethereum as the sole selected chain while aggregate popular mode is intended
Scenario: Perps still shows when directly on an EVM chain
Given the Perps feature flag is enabled
When the user selects an EVM network (e.g. Ethereum) from the picker
Then the Perps tab is visible
```
## **Screenshots/Recordings**
### **Before**
See #28035
### **After**
https://github.com/user-attachments/assets/f5192178-b7ae-4501-9daa-992afe0680cd
## **Pre-merge author checklist**
- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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.
#### Performance checks (if applicable)
Not applicable for this change (network filter / tab visibility only).
Left unchecked until you validate on device if required by your release
process.
- [ ] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [ ] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
## **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.
[TMCU-602]:
https://consensyssoftware.atlassian.net/browse/TMCU-602?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[TMCU-672]:
https://consensyssoftware.atlassian.net/browse/TMCU-672?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk UI gating change that only affects whether the Perps tab is
shown; main risk is incorrect tab visibility for certain multichain
network-filter states.
>
> **Overview**
> Restores Perps visibility on the Activity screen when the user
switches to *All popular networks* after selecting a non‑EVM network,
without forcing an EVM chain selection.
>
> `ActivityView` now enables the Perps tab when the feature flag is on
and either an EVM network is selected **or** all popular `eip155`
networks are enabled (via `useNetworksByCustomNamespace`). Tests update
mocks accordingly and add coverage for the non‑EVM + all popular EVM
networks case.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f0566bd. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Pedro Pablo Aste Kompen <wachunei@users.noreply.github.com>1 parent dbfe481 commit 95e7280
2 files changed
Lines changed: 32 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
102 | 110 | | |
103 | 111 | | |
104 | | - | |
105 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
106 | 115 | | |
107 | 116 | | |
108 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| 139 | + | |
137 | 140 | | |
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
141 | 148 | | |
142 | 149 | | |
143 | 150 | | |
| |||
263 | 270 | | |
264 | 271 | | |
265 | 272 | | |
| 273 | + | |
266 | 274 | | |
267 | 275 | | |
268 | 276 | | |
| |||
474 | 482 | | |
475 | 483 | | |
476 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
477 | 497 | | |
478 | 498 | | |
479 | 499 | | |
| |||
486 | 506 | | |
487 | 507 | | |
488 | 508 | | |
| 509 | + | |
489 | 510 | | |
490 | 511 | | |
491 | 512 | | |
| |||
0 commit comments