Skip to content

fix(activity): restore Perps after popular networks without forcing Ethereum#29676

Merged
wachunei merged 6 commits into
mainfrom
fix/TMCU-602-perps-popular-networks-sync
May 5, 2026
Merged

fix(activity): restore Perps after popular networks without forcing Ethereum#29676
wachunei merged 6 commits into
mainfrom
fix/TMCU-602-perps-popular-networks-sync

Conversation

@wachunei

@wachunei wachunei commented May 4, 2026

Copy link
Copy Markdown
Member

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). 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

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

after_perps_tab.mp4

Pre-merge author checklist

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 to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

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

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.

Reviewed by Cursor Bugbot for commit f0566bd. Bugbot is set up for automated code reviews on this repo. Configure here.

wachunei added 2 commits May 4, 2026 12:42
After Solana (or any non-EVM) selection, MultichainNetworkController kept
isEvmSelected false. Choosing "All popular networks" only updated
NetworkEnablementController, so Activity Perps tab stayed hidden (TMCU-602).

selectAllPopularNetworks now calls selectPopularNetwork for Ethereum
mainnet after enableAllPopularNetworks to restore setActiveNetwork on EVM.
Reverts selectPopularNetwork(eip155:1) after enableAllPopularNetworks (that
set the global EVM chain to mainnet and made the picker show Ethereum).

Perps tab now uses useNetworksByCustomNamespace(Eip155) so it stays visible
when all popular EVM networks are enabled, even if the active chain is Solana.
@wachunei wachunei self-assigned this May 4, 2026
@metamaskbotv2 metamaskbotv2 Bot added the team-money-movement issues related to Money Movement features label May 4, 2026
@github-actions github-actions Bot added the size-S label May 4, 2026
Keep only ActivityView changes for TMCU-602; hook files match main.
@wachunei wachunei requested a review from salimtb May 4, 2026 17:17
@wachunei wachunei marked this pull request as ready for review May 4, 2026 18:52

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 19386fb. Configure here.

Comment thread app/components/Views/ActivityView/index.test.tsx
cursoragent and others added 2 commits May 4, 2026 19:11
…Each

Move the reset of mockAreAllEvmPopularNetworksEnabled to the root
beforeEach block to ensure proper test isolation. Previously it was
only reset in the Perps tab describe block, which could cause stale
values to leak between unrelated test blocks.

Co-authored-by: Pedro Pablo Aste Kompen <wachunei@users.noreply.github.com>
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes modify the isPerpsEnabled logic in ActivityView/index.js to also show the Perps tab when areAllEvmPopularNetworksEnabled is true (via the new useNetworksByCustomNamespace hook with KnownCaipNamespace.Eip155), even when the user is on a non-EVM network. Previously, the Perps tab was only shown when isEvmSelected was true.

SmokePerps is selected because:

  • The change directly affects Perps tab visibility in the ActivityView
  • The new condition enables Perps when all popular EVM networks are selected (regardless of current network being EVM or non-EVM)
  • SmokePerps tests cover the Perps tab entry point and Add Funds flow which depend on this tab being visible

SmokeWalletPlatform is selected because:

  • Per the tag description, Perps is a section inside the Trending tab (SmokeWalletPlatform)
  • ActivityView is a core wallet platform component
  • The tag description explicitly states: "When selecting SmokePerps, also select SmokeWalletPlatform"

SmokeConfirmations is NOT selected because the change is only about tab visibility logic, not about the actual transaction/confirmation flows within Perps.

The change is medium risk - it modifies a conditional rendering logic that could affect user experience when switching between EVM and non-EVM networks, but the scope is limited to the Perps tab visibility in ActivityView.

Performance Test Selection:
The changes only modify a boolean condition in a useMemo hook (isPerpsEnabled) that determines tab visibility. This is a trivial computation with no performance impact - no rendering loops, no heavy data fetching, no list rendering changes, and no state management changes that would affect performance metrics.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 5, 2026

Copy link
Copy Markdown

@wachunei wachunei removed the request for review from salimtb May 5, 2026 19:36
@wachunei wachunei added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 95e7280 May 5, 2026
94 checks passed
@wachunei wachunei deleted the fix/TMCU-602-perps-popular-networks-sync branch May 5, 2026 19:54
@github-actions github-actions Bot locked and limited conversation to collaborators May 5, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.77.0 Issue or pull request that will be included in release 7.77.0 label May 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.77.0 Issue or pull request that will be included in release 7.77.0 size-S team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Activity : Perps tab not visible when switching from non EVM network to All Popular networks and Not available in Activity

3 participants