Skip to content

feat: OmniSearch integration in WebBrowser#25358

Merged
MarioAslau merged 10 commits intomainfrom
feat/omni-search-browser-integration
Jan 30, 2026
Merged

feat: OmniSearch integration in WebBrowser#25358
MarioAslau merged 10 commits intomainfrom
feat/omni-search-browser-integration

Conversation

@MarioAslau
Copy link
Copy Markdown
Contributor

@MarioAslau MarioAslau commented Jan 29, 2026

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:

  • When users type in the browser URL bar, they now see search results for:
    • Sites - Curated web3 sites matching the query
    • Recents - Recently visited URLs filtered by query
    • Favorites - Bookmarked URLs filtered by query
    • Tokens - Trending tokens with price and 24h change
    • Perps - Perpetual trading markets with leverage info
    • Predictions - Prediction markets from Polymarket

Architecture:

  • Reuses the existing useExploreSearch hook from TrendingView
  • Browser-specific section order: Sites → Recents → Favorites → Tokens → Perps → Predictions
  • Transforms API data (TrendingAsset, PerpsMarketData, PredictMarket) to unified AutocompleteSearchResult type
  • Wraps search content with PerpsConnectionProvider and PerpsStreamProvider for real-time data

Result Component Enhancements:

  • Extended Result.tsx to render all new result types (Tokens, Perps, Predictions)
  • Added swap button for token results that navigates to swap flow
  • Integrated TrendingTokenLogo and PerpsTokenLogo components
  • Shows price and percentage change for tokens and perps

Type System:

  • Added discriminated union types: TokenSearchResult, PerpsSearchResult, PredictionsSearchResult
  • AutocompleteSearchResult is now a union of all result types
  • Type-safe category handling with UrlAutocompleteCategory enum

E2E 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_MOCKS to the default mock configuration in tests/api-mocking/mock-responses/defaults/index.ts. These mocks already existed in trending-api-mocks.ts but weren't loaded into the E2E test harness.

Other Changes:

  • Fixed TypeScript error in DiscoveryTab.tsx with proper type narrowing for union types
  • Extended useExploreSearch hook to accept custom sectionsOrder option
  • Added comprehensive unit tests achieving 85%+ coverage

Files Changed (14 files)

File Description
UrlAutocomplete/index.tsx Main integration - omni-search hook, data transformers, search content
UrlAutocomplete/Result.tsx Extended to render Tokens, Perps, Predictions results
UrlAutocomplete/types.ts New types for all search result categories
UrlAutocomplete/UrlAutocomplete.constants.ts New constants for browser search config
UrlAutocomplete/index.test.tsx Unit tests for omni-search integration
UrlAutocomplete/Result.test.tsx New unit tests for Result component
BrowserTab/BrowserTab.tsx Updated to handle new result types in onSelect
DiscoveryTab/DiscoveryTab.tsx Fixed TypeScript error with type narrowing
ExploreSearchResults/ExploreSearchResults.tsx Minor updates for shared hook
ExploreSearchResults/ExploreSearchResults.test.tsx Improved test coverage
useExploreSearch.ts Added sectionsOrder option for custom ordering
useExploreSearch.test.ts New unit tests for hook
locales/languages/en.json Added localization strings for new categories
tests/api-mocking/.../defaults/index.ts Added TRENDING_API_MOCKS import to fix E2E smoke test failures

Changelog

CHANGELOG entry: Added omni-search to browser URL bar - search tokens, perps, and predictions directly from the browser

Related issues

Fixes:

Manual testing steps

Feature: Browser URL Bar Omni-Search

  Scenario: User searches for tokens in browser URL bar
    Given user is on the browser tab
    And user taps on the URL bar

    When user types "eth"
    Then user sees search results organized by category
    And user sees Sites section with matching web3 sites
    And user sees Tokens section with Ethereum and related tokens
    And each token shows name, symbol, price, and 24h change
    And each token has a swap button

  Scenario: User initiates swap from search result
    Given user has searched for "eth" in the URL bar
    And user sees Ethereum in the Tokens section

    When user taps the swap button on Ethereum
    Then user is navigated to the swap screen
    And Ethereum is pre-selected as the destination token

  Scenario: User searches for perps markets
    Given user is on the browser tab
    And user taps on the URL bar

    When user types "btc"
    Then user sees Perps section with BTC-USD market
    And market shows name, symbol, leverage, and price

  Scenario: User searches for prediction markets
    Given user is on the browser tab  
    And user taps on the URL bar

    When user types "bitcoin"
    Then user sees Predictions section with matching markets
    And each prediction shows title and status (Open/Closed/Resolved)

  Scenario: User sees empty state with recents and favorites
    Given user is on the browser tab
    And user has browser history and bookmarks

    When user taps on the URL bar without typing
    Then user sees Recents section with recent URLs
    And user sees Favorites section with bookmarked URLs

  Scenario: Basic functionality disabled hides API-dependent sections
    Given user has disabled basic functionality in settings
    And user is on the browser tab

    When user types a search query in the URL bar
    Then user only sees Recents and Favorites (local data)
    And user does not see Tokens, Perps, or Predictions sections

Screenshots/Recordings

Before

After

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

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.

Result now 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 sectionsOrder to useExploreSearch, tests are expanded/updated accordingly, new i18n strings are added for the new sections, and default E2E mocks now include TRENDING_API_MOCKS to cover the new token API calls.

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

- 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
@github-actions
Copy link
Copy Markdown
Contributor

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.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Jan 29, 2026
@MarioAslau MarioAslau changed the title feat: integrate omni-search into browser URL bar feat: OmniSearch integration in WebBrowser Jan 29, 2026
@MarioAslau
Copy link
Copy Markdown
Contributor Author

Old PR Conversation: #25312

Copy link
Copy Markdown
Contributor

@NicolasMassart NicolasMassart left a comment

Choose a reason for hiding this comment

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

nice, let me know when it's ready for final review

@MarioAslau MarioAslau marked this pull request as ready for review January 29, 2026 15:18
@MarioAslau MarioAslau requested review from a team as code owners January 29, 2026 15:18
Copy link
Copy Markdown

@cursor cursor bot left a comment

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 2 potential issues.

@MarioAslau MarioAslau self-assigned this Jan 29, 2026
cortisiko
cortisiko previously approved these changes Jan 29, 2026
sethkfman
sethkfman previously approved these changes Jan 29, 2026
Copy link
Copy Markdown
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

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

LGTM

Cal-L
Cal-L previously approved these changes Jan 29, 2026
Copy link
Copy Markdown
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

@MarioAslau MarioAslau dismissed stale reviews from Cal-L, sethkfman, and cortisiko via d2c682f January 29, 2026 23:25
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
This PR introduces a significant feature: omni-search in the browser URL autocomplete. The changes are extensive and touch multiple critical areas:

  1. Browser/UrlAutocomplete (Major Refactor): The UrlAutocomplete component has been completely refactored to integrate omni-search functionality from the TrendingView. It now searches across Sites, Tokens, Perps, and Predictions simultaneously. This is a core browser feature change.

  2. BrowserTab Navigation: New navigation handlers for Token details, Perps market details, and Predictions market details have been added. The component now handles different result types differently.

  3. TrendingView Integration: The useExploreSearch hook has been modified to accept custom section ordering, and ExploreSearchResults now uses this dynamic ordering.

  4. Result Component: Completely rewritten to handle multiple result types with appropriate icons, prices, and actions (including swap button for tokens).

  5. Test Infrastructure: TRENDING_API_MOCKS added to default E2E mocks, which could affect test behavior.

Selected Tags Rationale:

  • SmokeWalletPlatform: Required because the Trending discovery tab, browser navigation, and search functionality are directly affected. The trending-*.spec.ts tests use this tag and test the exact features being modified.
  • SmokeTrade: Required because token search results can trigger swap navigation via the new swap button, and the useSwapBridgeNavigation hook is integrated.
  • SmokePerps: Required because Perps search results navigate to Perps market details, and the PerpsConnectionProvider/PerpsStreamProvider are now used in the browser search.
  • SmokePredictions: Required because Predictions search results navigate to Predictions market details from the browser search.

The risk is HIGH because:

  • Core browser functionality is being modified
  • Multiple navigation flows are affected
  • Integration with trading features (Swaps, Perps, Predictions)
  • Changes to shared hooks used by multiple components
  • Test infrastructure changes (default mocks)

Performance Test Selection:
While this PR adds new search functionality and integrates multiple data sources (Sites, Tokens, Perps, Predictions) into the browser autocomplete, the performance impact is likely minimal because: 1) The useExploreSearch hook already exists and is being reused, not newly created. 2) The search is debounced. 3) No changes to core rendering patterns like list virtualization. 4) No changes to app startup, login, or asset loading flows. 5) The changes are primarily about routing search results to different detail screens rather than heavy data processing. The existing performance tests don't cover browser search specifically, and the changes don't warrant creating new performance test scenarios.

View GitHub Actions results

Copy link
Copy Markdown
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link
Copy Markdown

@MarioAslau MarioAslau enabled auto-merge January 30, 2026 00:04
@MarioAslau MarioAslau added this pull request to the merge queue Jan 30, 2026
Merged via the queue into main with commit 93fba69 Jan 30, 2026
152 of 155 checks passed
@MarioAslau MarioAslau deleted the feat/omni-search-browser-integration branch January 30, 2026 00:22
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2026
@metamaskbot metamaskbot added the release-7.65.0 Issue or pull request that will be included in release 7.65.0 label Jan 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.65.0 Issue or pull request that will be included in release 7.65.0 size-XL team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants