Skip to content

chore(analytics): drop saveDataRecording from Tokens util + sweep assets test mocks#31990

Merged
NicolasMassart merged 2 commits into
mainfrom
analytics/finish-pr-a-assets
Jun 22, 2026
Merged

chore(analytics): drop saveDataRecording from Tokens util + sweep assets test mocks#31990
NicolasMassart merged 2 commits into
mainfrom
analytics/finish-pr-a-assets

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

Removes the unused saveDataRecording?: boolean second argument from the trackEvent prop type in goToAddEvmToken and removeEvmToken. That parameter was a holdover from the legacy MetaMetrics API; useAnalytics's trackEvent never accepted a second argument. Sweeps the now-dead setSaveDataRecording: jest.fn().mockReturnThis() key from the two affected test builder mocks.

This is PR-A of 6 in the owner-scoped sequence finishing the legacy MetaMetrics migration (#26820). PRs A–E are parallel mock-sweeps; PR-F does the interface removal once all five merge.

Changelog

CHANGELOG entry: null

Related issues

Refs: #26820

Manual testing steps

N/A — test-only and type-signature cleanup; unit tests cover the changed files.

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

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

Low Risk
Type-signature and test-mock cleanup only; analytics call paths are unchanged and trackEvent already ignored the removed parameter.

Overview
Continues the legacy MetaMetrics cleanup (#26820) by aligning Assets token helpers and tests with useAnalytics’s single-argument trackEvent.

goToAddEvmToken and removeEvmToken no longer type trackEvent with an optional saveDataRecording second parameter—that API was never implemented on the hook. DeFiPositionsList.test.tsx and Tokens/index.test.tsx drop setSaveDataRecording from mocked createEventBuilder chains for the same reason.

No runtime behavior change; typings and test doubles only.

Reviewed by Cursor Bugbot for commit bf7b2a1. Bugbot is set up for automated code reviews on this repo. Configure here.

…ets test mocks

Removes the unused `saveDataRecording?: boolean` second arg from the
`trackEvent` prop type in `goToAddEvmToken` and `removeEvmToken`. The
arg was a holdover from the legacy `MetaMetrics` API; `useAnalytics`'s
`trackEvent` never accepted it. Sweeps the now-dead
`setSaveDataRecording: jest.fn().mockReturnThis()` line from the two
affected test builder mocks.

Part of #26820, closes when all 6 owner-scoped PRs land.

Co-authored-by: Cursor <cursoragent@cursor.com>
@NicolasMassart NicolasMassart requested a review from a team as a code owner June 18, 2026 12:32
@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.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-mobile-platform Mobile Platform team label Jun 18, 2026
@mm-token-exchange-service mm-token-exchange-service Bot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 18, 2026
@github-actions github-actions Bot added size-S risk:medium AI analysis: medium risk labels Jun 18, 2026
@NicolasMassart NicolasMassart marked this pull request as draft June 18, 2026 12:36
@NicolasMassart NicolasMassart self-assigned this Jun 18, 2026
@mm-token-exchange-service mm-token-exchange-service Bot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Jun 18, 2026
@NicolasMassart NicolasMassart marked this pull request as ready for review June 18, 2026 13:09
@NicolasMassart NicolasMassart added skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. and removed skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. labels Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 4 changed files contain only minor TypeScript interface/type signature changes and corresponding test mock updates:

  1. goToAddEvmToken.ts and removeEvmToken.ts: Removed the optional saveDataRecording?: boolean parameter from the trackEvent function type in their respective Props interfaces. This is a type-only change with no runtime behavior impact.

  2. Tokens/index.test.tsx and DeFiPositions/DeFiPositionsList.test.tsx: Removed setSaveDataRecording: jest.fn().mockReturnThis() from mock builder objects to align with the updated interface.

These changes:

  • Do not affect any user-facing functionality
  • Do not change any navigation flows
  • Do not modify any controller logic
  • Do not affect any E2E test paths
  • Are purely TypeScript type cleanup (removing an unused optional parameter)

No E2E tests need to run for these changes as they have zero functional impact on any user flows.

Performance Test Selection:
The changes are purely TypeScript interface/type signature cleanup (removing an optional parameter from trackEvent function types) with no runtime behavior changes. There is no impact on app performance, rendering, or any measured performance flows.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR continues the legacy MetaMetrics migration cleanup by removing an unused saveDataRecording?: boolean second parameter from trackEvent prop typings in Tokens utilities, and updating affected unit-test event-builder mocks accordingly.

Changes:

  • Simplifies trackEvent prop types in goToAddEvmToken and removeEvmToken to accept only AnalyticsTrackingEvent.
  • Removes now-dead setSaveDataRecording from mocked createEventBuilder chains in the impacted tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
app/components/UI/Tokens/util/removeEvmToken.ts Updates trackEvent prop type to a single-argument signature aligned with useAnalytics.
app/components/UI/Tokens/util/goToAddEvmToken.ts Updates trackEvent prop type to a single-argument signature aligned with useAnalytics.
app/components/UI/Tokens/index.test.tsx Removes setSaveDataRecording from the local analytics event-builder mock chain.
app/components/UI/DeFiPositions/DeFiPositionsList.test.tsx Removes setSaveDataRecording from the local analytics event-builder mock chain.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Jun 22, 2026
@NicolasMassart NicolasMassart added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit 159d9ed Jun 22, 2026
76 checks passed
@NicolasMassart NicolasMassart deleted the analytics/finish-pr-a-assets branch June 22, 2026 17:19
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-8.1.0 Issue or pull request that will be included in release 8.1.0 label Jun 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.1.0 Issue or pull request that will be included in release 8.1.0 risk:medium AI analysis: medium risk size-S team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants