[pull] main from MetaMask:main#387
Merged
Merged
Conversation
## **Description**
Fixes issue where custom trending browser uses a different design
compared to the original.
This PR removes our custom browser wrapper in favour of the original
browser + behaviour -- the mobile platform team will spearhead the IAB
changes.
For visibility:
Navigation Structure Before:
```
(TAB) REMOVED Browser Tab -- removing this caused issues for areas using old browser navigation
(TAB) Trending Tab (ExploreFlow)
(STACK) Trending
(STACK) Trending
- TRENDING_FEED
- EXPLORE_SEARCH
- Custom Browser
```
Navigation Structure After:
```
(TAB) Browser Tab (BrowserFlow) -- Keeping original browser tab, but it is hidden - existing navigations will still work
- BROWSER.VIEW
- BROWSER.ASSET_LOADER
- BROWSER.ASSET_VIEW
(TAB) Trending Tab (ExploreFlow)
- TRENDING_FEED
- EXPLORE_SEARCH
- Dedicated BrowserFlow screen -- Allows trending page to use existing browser (no custom browser), and retains trending navigation back behaviour (search queries and navigation stack is retained)
```
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: refactor: modify trending/explore page navigation
stacks
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
https://www.loom.com/share/bb1343b7a7ed4b1abb841f8c6d1284f3
## **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
- [x] 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.
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Refactors Explore/Trending to use the main Browser flow (with a hidden
Browser tab), adds `TRENDING_FEED`, and enhances TabBar to support
custom selection/hidden states, updating routes and tests accordingly.
>
> - **Navigation / Explore-Trending**:
> - Replace custom Trending browser with existing `BrowserFlow`; remove
`BrowserWrapper` and related screens.
> - Introduce `ExploreHome` stack with `Routes.TRENDING_FEED`,
`Routes.EXPLORE_SEARCH`, `Routes.SITES_FULL_VIEW`, and nested
`Routes.BROWSER.HOME`.
> - Keep `Routes.BROWSER.HOME` as a hidden tab when trending is enabled;
Trending tab considers both `TRENDING_VIEW` and `BROWSER.HOME` as
selected.
> - Update `BrowserTab` back behavior to return to `TRENDING_VIEW ->
TRENDING_FEED` when not launched from Trending.
> - Add `Routes.TRENDING_FEED`.
> - **TabBar**:
> - Add `options.isSelected(rootScreenName)` and `options.isHidden` to
`ExtendedBottomTabDescriptor`.
> - Change Trending tab press to `navigation.reset({ routes: [{ name:
Routes.TRENDING_VIEW }] })`.
> - **Sites/Explore interactions**:
> - `SiteRowItemWrapper` and `SitesSearchFooter` now navigate to
`Routes.BROWSER.HOME` with `screen: Routes.BROWSER.VIEW` and `{
fromTrending: true, newTabUrl, timestamp }`.
> - **Tests / Snapshots**:
> - Update unit tests and snapshots for new navigation targets and
removal of deprecated screens (`TrendingBrowser`, `BrowserWrapper`).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ec05612. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description** Optimize HyperLiquid/HIP-3 connection initialization to reduce API calls and improve Perps loading time. **Problem:** - Perps initialization made 19+ redundant API calls during HIP-3 connection setup - Race conditions caused duplicate `metaAndAssetCtxs()` and `perpDexs()` calls - No cache sharing between Provider and SubscriptionService **Solution:** - Replace separate `meta()` calls with combined `metaAndAssetCtxs()` in `buildAssetMapping` (-5 calls) - Add promise deduplication in `ensureReady()` and `getValidatedDexs()` to prevent concurrent duplicate calls - Implement cache sharing between Provider and SubscriptionService via `setDexMetaCache()`, `setDexAssetCtxsCache()` **Result:** API calls reduced from **19 → 15** during core initialization ### Core Init (All Entry Points) - 15 Calls | Category | Calls | Details | |----------|-------|---------| | DEX Discovery | 1 | `perpDexs` | | Metadata | 5 | `metaAndAssetCtxs` × 5 DEXes | | User Setup | 4 | `referral` × 2, `maxBuilderFee`, `userDexAbstraction` | | Prices | 5 | `allMids` × 5 DEXes | | **Total** | **15** | | ### View-Specific: PerpsHomeView Only - 2 Additional Calls | Category | Calls | Details | |----------|-------|---------| | Activity | 2 | `userFills`, `userNonFundingLedgerUpdates` | ### Total API Calls by Entry Point | Entry Point | Core Init | View-Specific | Total | |-------------|-----------|---------------|-------| | PerpsTabView (wallet tab) | 15 | 0 | **15** | | PerpsHomeView (full screen) | 15 | 2 | **17** | ## **Changelog** CHANGELOG entry: null ## **Related issues** - https://consensyssoftware.atlassian.net/browse/TAT-2211 ## **Manual testing steps** ```gherkin Feature: Perps HIP-3 Loading Performance Scenario: Faster initialization with fewer API calls Given user has MetaMask mobile app with Perps feature enabled When user navigates to Perps tab Then Perps markets should load successfully And network console should show ~15 API calls (not 19+) And HIP-3 markets (stocks like TSLA, NVDA) should appear alongside crypto ``` ## **Screenshots/Recordings** N/A - Performance optimization, no UI changes ### **Before** N/A ### **After** N/A ## **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 - [x] 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. ## **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.
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )