Skip to content

fix: Fix network picker in IAB not reflecting dapp selected network#28285

Merged
adonesky1 merged 9 commits intomainfrom
jl/WAPI-1031/fix-network-picker-iab-fullscreen
Apr 2, 2026
Merged

fix: Fix network picker in IAB not reflecting dapp selected network#28285
adonesky1 merged 9 commits intomainfrom
jl/WAPI-1031/fix-network-picker-iab-fullscreen

Conversation

@jiexi
Copy link
Copy Markdown
Member

@jiexi jiexi commented Apr 1, 2026

Description

Fixes a bug where the network selector icon in the In-App Browser was stuck displaying the global selected network due to incorrect dapp origin information being used

Changelog

CHANGELOG entry: Fixed a bug where the network selector icon in the In-App Browser would not correctly reflect the currently selected network for the dapp

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/WAPI-1031

Manual testing steps

  1. Open Explore
  2. Click the top right In-App Browser tab icon
  3. Tap the top right network selector icon
  4. Select a network that differs from the current icon
  5. The icon should change to match

Screenshots/Recordings

Before

Screen.Recording.2026-04-01.at.11.55.11.AM.mov

After

Screen.Recording.2026-04-01.at.11.44.32.AM.mov

Pre-merge author checklist

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: scoped UI/navigation parameter plumbing to ensure per-dapp network context is used; main risk is callers missing the new required dappOrigin prop or origin parsing yielding empty origin in edge URLs.

Overview
Fixes the In-App Browser network picker/avatar to reflect the dapp-selected network by threading an explicit dappOrigin through BrowserUrlBar into AccountRightButton.

AccountRightButton no longer derives origin from navigation route params; it now uses dappOrigin for useNetworkInfo and includes it as hostInfo.metadata.origin when opening the NetworkSelector sheet, so the selector can resolve the per-origin network. Tests were updated accordingly to supply a non-empty dappOrigin and remove the useRoute mock.

Written by Cursor Bugbot for commit 9c4cbaa. This will update automatically on new commits. Configure here.

@jiexi jiexi requested a review from a team as a code owner April 1, 2026 18:48
@metamaskbot metamaskbot added the team-wallet-integrations Wallet Integrations team label Apr 1, 2026
@github-actions github-actions bot added size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 1, 2026
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These changes can be pulled into a separate PR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this can be reverted. My local android build isn't working without this

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.

🤔

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.

Ok weird. No idea. lets revert before we merge I think

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

can be reverted. my ios build isn't working without this

* @param {bool} disableNetwork - Boolean that specifies if the network can be changed, defaults to false
* @returns {Object} - Corresponding navbar options containing headerTitle, headerLeft, headerTruncatedBackTitle and headerRight
*/
export function getTransactionsNavbarOptions(
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.

So this just wasn't used and this is a cleanup on the side?

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.

Oh I see you would've had to add a prop and this component is just not used 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

right

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I want to remove it to make it clear that AccountRightButton will always be called with dappOrigin. Removing this does that

@jiexi jiexi changed the base branch from main to jl/remove-dead-transaction-navbar-code April 1, 2026 20:01
adonesky1
adonesky1 previously approved these changes Apr 1, 2026
Base automatically changed from jl/remove-dead-transaction-navbar-code to main April 2, 2026 18:54
@jiexi jiexi dismissed adonesky1’s stale review April 2, 2026 18:54

The base branch was changed.

@adonesky1 adonesky1 enabled auto-merge April 2, 2026 19:14
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 2, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.90%. Comparing base (bd7e6fd) to head (eeb53c5).
⚠️ Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
app/components/UI/AccountRightButton/index.tsx 66.66% 0 Missing and 1 partial ⚠️
app/components/UI/BrowserUrlBar/BrowserUrlBar.tsx 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28285      +/-   ##
==========================================
+ Coverage   82.66%   82.90%   +0.23%     
==========================================
  Files        4866     4873       +7     
  Lines      126134   126361     +227     
  Branches    28268    28330      +62     
==========================================
+ Hits       104273   104754     +481     
+ Misses      14660    14398     -262     
- Partials     7201     7209       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes refactor how dappOrigin is passed to the AccountRightButton component and subsequently to the network selector. Previously, AccountRightButton derived the origin from route params using useRoute and UrlParser. Now, the parent BrowserUrlBar computes the origin from activeUrl and passes it as a prop.

Key impacts:

  1. Network selector with dApp context: The dappOrigin is passed as hostInfo.metadata.origin to the network selector navigation params. This affects per-dApp network selection — when a user opens the network selector from within a dApp browser, the correct dApp origin must be passed to show/manage chain permissions for that dApp.
  2. BrowserUrlBar → BrowserTab → Browser/DiscoveryTab: The change flows through the browser component hierarchy, affecting all dApp browser interactions.
  3. Chain permissions: SmokeNetworkAbstractions covers the chain permission system for dApps, which is directly affected.
  4. Multi-chain API: SmokeMultiChainAPI tests CAIP-25 session management which relies on correct origin passing.
  5. SmokeNetworkExpansion: Solana and multi-chain provider dApp flows use the browser and network selector.
  6. SmokeConfirmations: Per-dApp network selection within confirmations is mentioned in the tag description, and confirmations are triggered from dApp browser interactions.
  7. SmokeWalletPlatform: The DiscoveryTab uses BrowserUrlBar and browser navigation integration.

The change is a clean refactoring (moving URL parsing responsibility up the component tree) but touches a critical path for dApp browser interactions and network/chain permission flows.

Performance Test Selection:
The changes are a refactoring of prop passing (moving URL parsing from AccountRightButton to BrowserUrlBar). There is no new data fetching, list rendering, or performance-sensitive operations introduced. The dappOrigin computation uses a simple URLParse call memoized with useMemo, which has negligible performance impact. No performance tests are warranted.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

@adonesky1 adonesky1 added this pull request to the merge queue Apr 2, 2026
Merged via the queue into main with commit a173556 Apr 2, 2026
181 of 189 checks passed
@adonesky1 adonesky1 deleted the jl/WAPI-1031/fix-network-picker-iab-fullscreen branch April 2, 2026 21:48
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2026
@weitingsun weitingsun added release-7.74.0 Issue or pull request that will be included in release 7.74.0 and removed release-99999.1.0 labels Apr 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.74.0 Issue or pull request that will be included in release 7.74.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-M team-wallet-integrations Wallet Integrations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants