feat: OmniSearch integration in WebBrowser#25358
Conversation
- Add Sites, Tokens, Perps, and Predictions search results from useExploreSearch hook - Maintain Recents/Favorites for empty state - Filter Recents/Favorites with Fuse.js when searching - Order results: Sites > Recents > Favorites > Tokens > Perps > Predictions - Add navigation handlers for Tokens, Perps, and Predictions results - Use TrendingTokenLogo and PerpsTokenLogo for proper icon rendering - Handle native token addresses with NATIVE_SWAPS_TOKEN_ADDRESS
|
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. |
|
Old PR Conversation: #25312 |
app/components/Views/TrendingView/components/ExploreSearchResults/ExploreSearchResults.test.tsx
Show resolved
Hide resolved
app/components/Views/TrendingView/components/ExploreSearchResults/ExploreSearchResults.test.tsx
Outdated
Show resolved
Hide resolved
NicolasMassart
left a comment
There was a problem hiding this comment.
nice, let me know when it's ready for final review
d2c682f
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Selected Tags Rationale:
The risk is HIGH because:
Performance Test Selection: |
|



Description
This PR integrates the omni-search feature from the Explore page into the browser URL bar autocomplete, enabling users to search across multiple categories directly from the browser.
Jira Ticket: https://consensyssoftware.atlassian.net/browse/MCWP-218
What changed
New Omni-Search Integration:
Architecture:
useExploreSearchhook from TrendingViewAutocompleteSearchResulttypePerpsConnectionProviderandPerpsStreamProviderfor real-time dataResult Component Enhancements:
Result.tsxto render all new result types (Tokens, Perps, Predictions)TrendingTokenLogoandPerpsTokenLogocomponentsType System:
TokenSearchResult,PerpsSearchResult,PredictionsSearchResultAutocompleteSearchResultis now a union of all result typesUrlAutocompleteCategoryenumE2E Test Fixes:
The omni-search integration introduced new API calls that caused E2E smoke tests to fail with "unmocked request" errors:
GET https://token.api.cx.metamask.io/tokens/search?...GET https://token.api.cx.metamask.io/v3/tokens/trending?...Fix: Added
TRENDING_API_MOCKSto the default mock configuration intests/api-mocking/mock-responses/defaults/index.ts. These mocks already existed intrending-api-mocks.tsbut weren't loaded into the E2E test harness.Other Changes:
DiscoveryTab.tsxwith proper type narrowing for union typesuseExploreSearchhook to accept customsectionsOrderoptionFiles Changed (14 files)
UrlAutocomplete/index.tsxUrlAutocomplete/Result.tsxUrlAutocomplete/types.tsUrlAutocomplete/UrlAutocomplete.constants.tsUrlAutocomplete/index.test.tsxUrlAutocomplete/Result.test.tsxBrowserTab/BrowserTab.tsxDiscoveryTab/DiscoveryTab.tsxExploreSearchResults/ExploreSearchResults.tsxExploreSearchResults/ExploreSearchResults.test.tsxuseExploreSearch.tsuseExploreSearch.test.tslocales/languages/en.jsontests/api-mocking/.../defaults/index.tsTRENDING_API_MOCKSimport to fix E2E smoke test failuresChangelog
CHANGELOG entry: Added omni-search to browser URL bar - search tokens, perps, and predictions directly from the browser
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
OmniSearchFunctionality.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Expands browser URL autocomplete into a multi-source search that now triggers additional API-driven sections and new navigation paths (asset/perps/predictions and swaps). Risk is mainly around UI correctness, section ordering/loading, and navigation/selection behavior rather than security-critical logic.
Overview
Browser URL autocomplete is refactored to use
useExploreSearch(with a browser-specific section order) and to combine API-driven results (sites/tokens/perps/predictions) with locally filtered recents/favorites; empty state is now explicitly limited to recents/favorites.Resultnow renders new result types with appropriate icons and metadata (token price/24h change, perps leverage/price/change, prediction status/image) and adds a token swap action button. Selection handling is updated so token/perps/predictions navigate to their detail screens (and avoid auto-hiding autocomplete), while URL-based results continue to navigate the webview.Shared search plumbing is extended by adding an optional
sectionsOrdertouseExploreSearch, tests are expanded/updated accordingly, new i18n strings are added for the new sections, and default E2E mocks now includeTRENDING_API_MOCKSto cover the new token API calls.Written by Cursor Bugbot for commit d2c682f. This will update automatically on new commits. Configure here.