refactor(analytics): D4 migrate useMetrics to useAnalytics in Notifications + Mobile Core UX#28297
Conversation
|
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. |
There was a problem hiding this comment.
this is removing stale tests of analytics removed in #21858 last year
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
All changes are internal refactoring with no user-facing functional changes. The
No other tags are needed since: no confirmation flows changed, no account management changed, no network/chain logic changed, no swap/trade flows changed. Performance Test Selection: |
|
|
✅ E2E Fixture Validation — Schema is up to date |



Description
Part of the analytics cleanup workstream migrating from the legacy
useMetricshook to the newuseAnalyticshook.This PR covers ~3 files in the Notifications and Mobile Core UX areas:
app/components/UI/Notification/List/index.tsx— replacesuseMetricswithuseAnalyticsapp/components/UI/MarketInsights/Views/MarketInsightsView/MarketInsightsView.tsx— fixesMetaMetricsEventsimport to source fromcore/AnalyticsdirectlycreateMockUseAnalyticsHookandjest.mocked()pattern instead of manual mock factoriesChangelog
CHANGELOG entry: null
Related issues
Fixes: #26818
Manual testing steps
N/A
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk refactor limited to analytics plumbing and test mocks; primary risk is missing/incorrect event tracking due to hook or import changes.
Overview
Refactors Notifications analytics to use the new
useAnalyticshook (instead of legacyuseMetrics) when marking notifications read and emittingMetaMetricsEvents.NOTIFICATION_CLICKED.Updates related tests to mock
useAnalyticsviacreateMockUseAnalyticsHook, and removes now-unused metrics mocking fromMainNotificationToggle.hooks.test.tsx. Also alignsMarketInsightsViewto importMetaMetricsEventsfromcore/Analytics.Written by Cursor Bugbot for commit a7c19a6. This will update automatically on new commits. Configure here.