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
When the user navigates to a token's details page and then opens Swap from there, the navigation stack looks like:
[Home → Asset(TokenA) → Bridge]
Tapping a trending token inside the Swap/Bridge screen calls navigation.navigate('Asset', tokenBParams). React Navigation's navigate traverses the stack looking for an existing matching route — it finds the already-present Asset(TokenA) screen and navigates back to it, dismissing the Bridge screen. The user ends up on the original token's details page instead of the tapped trending token's details page.
Fix
Replace navigation.navigate('Asset', ...) with navigation.dispatch(StackActions.push('Asset', ...)) in TrendingTokenRowItem. StackActions.push always creates a new screen instance regardless of what is already on the stack, so the navigation flows correctly forward to the tapped token. When push is dispatched from a nested navigator that does not register 'Asset' (e.g. BridgeScreenStack or ExploreHome), React Navigation bubbles the action up to the root modal stack which does register it — matching the behaviour already used in BridgeTokenSelector for the same reason.
Tests are updated to assert that navigation.dispatch is called with the correct StackActions.push action and that navigation.navigate is no longer called.
Changelog
CHANGELOG entry: Fixed tapping a trending token from the Swap screen dismissing Swap instead of opening the token details page
Feature: Trending token navigation from Swap screenBackground:
Given I am logged into MetaMask Mobile
And I have at least one token in my wallet
Scenario: user navigates to a trending token from Swap opened via token details pageGiven I am on a token details page (e.g. mUSD)
And I can see the "Swap" action button
When user taps "Swap"Then the Swap screen opens
And I can see a list of trending tokens
When user taps on a trending token (e.g. Sigma)
Then the Sigma token details page opens
And the Swap screen is no longer visible
Scenario: user navigates to a trending token from Swap opened directly (not from token details)Given I am on the Wallet home screen
When user opens the Swap screen directly
And user taps on a trending token (e.g. Everlyn Token)
Then the Everlyn Token details page opens
Scenario: user navigates to a trending token from the Explore tabGiven I am on the Explore tab
When user taps on a trending token
Then the token details page for that token opens
Screenshots/Recordings
Before
Tapping a trending token from Swap (opened via token details page) dismisses Swap and returns to the original token details page.
After
Tapping a trending token from Swap navigates forward to the tapped token's details page.
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 format if applicable
I've applied the right labels on the PR (see labeling guidelines). 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.
Note
Medium Risk
Changes navigation behavior for trending token taps by forcing a new Asset screen onto the stack; risk is mainly UX/regression if the action doesn’t bubble correctly in some navigators.
Overview
Fixes trending-token taps to always open a new token details screen by replacing navigation.navigate('Asset', ...) with navigation.dispatch(StackActions.push('Asset', ...)) in TrendingTokenRowItem.
Updates TrendingTokenRowItem tests to mock dispatch and assert StackActions.push is used (and navigate is not), including cases where a popular network must be added first or navigation is suppressed on failure.
Written by Cursor Bugbot for commit e2f50ab. This will update automatically on new commits. Configure here.
Selected Performance tags: None (no tests recommended)
Risk Level: low
AI Confidence: 88%
click to see 🤖 AI reasoning details
E2E Test Selection:
The changes are limited to two files in the TrendingTokenRowItem component:
TrendingTokenRowItem.tsx: Changed navigation from navigation.navigate('Asset', assetParams) to navigation.dispatch(StackActions.push('Asset', assetParams)). This is a targeted navigation fix to ensure a new Asset screen is always pushed onto the navigation stack when tapping a token in the Trending tab, preventing unintended dismissal of screens like Bridge.
TrendingTokenRowItem.test.tsx: Unit test updates to match the new navigation behavior (checking mockDispatch with StackActions.push instead of mockNavigate).
Tag Selection Rationale:
SmokeWalletPlatform is the appropriate tag because the Trending discovery tab (including the Tokens section with TrendingTokenRowItem) is explicitly covered by this tag. The change affects how token navigation works from the Trending tab.
No other tags are needed: this is not a confirmation flow, not a swap/bridge flow initiation, not an account management change, and not a network/chain permission change.
The fix is low-risk — it's a navigation method change (navigate → push) that improves stack behavior without changing the destination or parameters passed.
Performance Test Selection:
No performance impact expected. The change is a navigation method switch (navigate → StackActions.push) which has negligible performance difference. No rendering, data loading, state management, or list rendering changes were made.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
When the user navigates to a token's details page and then opens Swap from there, the navigation stack looks like:
Tapping a trending token inside the Swap/Bridge screen calls
navigation.navigate('Asset', tokenBParams). React Navigation'snavigatetraverses the stack looking for an existing matching route — it finds the already-presentAsset(TokenA)screen and navigates back to it, dismissing the Bridge screen. The user ends up on the original token's details page instead of the tapped trending token's details page.Fix
Replace
navigation.navigate('Asset', ...)withnavigation.dispatch(StackActions.push('Asset', ...))inTrendingTokenRowItem.StackActions.pushalways creates a new screen instance regardless of what is already on the stack, so the navigation flows correctly forward to the tapped token. Whenpushis dispatched from a nested navigator that does not register'Asset'(e.g.BridgeScreenStackorExploreHome), React Navigation bubbles the action up to the root modal stack which does register it — matching the behaviour already used inBridgeTokenSelectorfor the same reason.Tests are updated to assert that
navigation.dispatchis called with the correctStackActions.pushaction and thatnavigation.navigateis no longer called.Changelog
CHANGELOG entry: Fixed tapping a trending token from the Swap screen dismissing Swap instead of opening the token details page
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4271
Manual testing steps
Screenshots/Recordings
Before
Tapping a trending token from Swap (opened via token details page) dismisses Swap and returns to the original token details page.
After
Tapping a trending token from Swap navigates forward to the tapped token's details page.
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes navigation behavior for trending token taps by forcing a new
Assetscreen onto the stack; risk is mainly UX/regression if the action doesn’t bubble correctly in some navigators.Overview
Fixes trending-token taps to always open a new token details screen by replacing
navigation.navigate('Asset', ...)withnavigation.dispatch(StackActions.push('Asset', ...))inTrendingTokenRowItem.Updates
TrendingTokenRowItemtests to mockdispatchand assertStackActions.pushis used (andnavigateis not), including cases where a popular network must be added first or navigation is suppressed on failure.Written by Cursor Bugbot for commit e2f50ab. This will update automatically on new commits. Configure here.