Skip to content

refactor(analytics): PR E4 migrate TradeTabBarItem from useMetrics to useAnalytics#30501

Merged
NicolasMassart merged 1 commit into
mainfrom
refactor/26686_e4-ds_migrate-trade-tab-bar
May 21, 2026
Merged

refactor(analytics): PR E4 migrate TradeTabBarItem from useMetrics to useAnalytics#30501
NicolasMassart merged 1 commit into
mainfrom
refactor/26686_e4-ds_migrate-trade-tab-bar

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented May 21, 2026

Copy link
Copy Markdown
Contributor

Description

Part of the analytics cleanup workstream (#26686).

Migrates TradeTabBarItem from the deprecated useMetrics to useAnalytics. Moves the MetaMetricsEvents import from the useMetrics barrel to core/Analytics directly, consistent with other already-migrated components.

Files touched:

  • TradeTabBarItem/TradeTabBarItem.tsx — replace useMetrics import with useAnalytics, move MetaMetricsEvents import to core/Analytics

Changelog

CHANGELOG entry: null

Related issues

Closes: #30514
Refs: #26686

Manual testing steps

N/A

Screenshots/Recordings

Before

N/A — no UI changes.

After

N/A — no UI changes.

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, test affected areas)
  • I confirm that this PR addresses what is claimed in the PR title
  • I confirm that I've manually reviewed the changes if not manually tested

… useAnalytics

Replaces useMetrics with useAnalytics in TradeTabBarItem.tsx and updates the
MetaMetricsEvents import to come directly from core/Analytics. Part of analytics
cleanup workstream (#26686).

Co-authored-by: Cursor <cursoragent@cursor.com>
@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.

@metamaskbotv2 metamaskbotv2 Bot added the team-mobile-platform Mobile Platform team label May 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The change in TradeTabBarItem.tsx is a pure analytics hook refactoring:

  • Replaces useMetrics import from ../../../../components/hooks/useMetrics with useAnalytics from ../../../../components/hooks/useAnalytics/useAnalytics
  • Replaces MetaMetricsEvents import source from useMetrics to ../../../../core/Analytics
  • The actual usage (trackEvent, createEventBuilder) remains identical

TradeTabBarItem is used in TabBarItem (navigation component), which is used in trading-related views including Perps, Predictions, and Swap flows. Since this component is part of the navigation bar for trading features, tests covering those flows should be run to verify the analytics refactoring doesn't break anything.

Per tag descriptions:

  • SmokePerps: TradeTabBarItem is the entry point for Perps via TradeWalletActions
  • SmokePredictions: TradeTabBarItem is the entry point for Predictions via TradeWalletActions
  • SmokeSwap: TradeTabBarItem is used in swap navigation
  • SmokeWalletPlatform: Trending tab uses TabBarItem/TradeTabBarItem for navigation
  • SmokeConfirmations: Required when selecting SmokePerps, SmokePredictions, and SmokeSwap per their descriptions

The risk is low since this is purely a refactoring with no behavioral change, but we should validate the analytics hook swap doesn't cause runtime errors in the affected flows.

Performance Test Selection:
This change is a pure analytics hook refactoring (useMetrics → useAnalytics) with no impact on rendering performance, data loading, or UI responsiveness. No performance tests are needed.

View GitHub Actions results

@NicolasMassart NicolasMassart changed the title refactor(analytics): migrate TradeTabBarItem from useMetrics to useAnalytics [E4] refactor(analytics): PR E4 migrate TradeTabBarItem from useMetrics to useAnalytics May 21, 2026
@sonarqubecloud

Copy link
Copy Markdown

@NicolasMassart NicolasMassart added this pull request to the merge queue May 21, 2026
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue May 21, 2026
Merged via the queue into main with commit 00b3769 May 21, 2026
261 of 327 checks passed
@NicolasMassart NicolasMassart deleted the refactor/26686_e4-ds_migrate-trade-tab-bar branch May 21, 2026 15:37
@github-actions github-actions Bot locked and limited conversation to collaborators May 21, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.79.0 Issue or pull request that will be included in release 7.79.0 label May 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

refactor(analytics): PR E4 design-system — migrate TradeTabBarItem from useMetrics to useAnalytics

2 participants