chore(analytics): drop saveDataRecording from Tokens util + sweep assets test mocks#31990
Conversation
…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>
|
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes:
No E2E tests need to run for these changes as they have zero functional impact on any user flows. Performance Test Selection: |
|
There was a problem hiding this comment.
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
trackEventprop types ingoToAddEvmTokenandremoveEvmTokento accept onlyAnalyticsTrackingEvent. - Removes now-dead
setSaveDataRecordingfrom mockedcreateEventBuilderchains 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.



Description
Removes the unused
saveDataRecording?: booleansecond argument from thetrackEventprop type ingoToAddEvmTokenandremoveEvmToken. That parameter was a holdover from the legacy MetaMetrics API;useAnalytics'strackEventnever accepted a second argument. Sweeps the now-deadsetSaveDataRecording: 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)
trace()for usage andaddTokenfor an examplePre-merge reviewer checklist
Note
Low Risk
Type-signature and test-mock cleanup only; analytics call paths are unchanged and
trackEventalready ignored the removed parameter.Overview
Continues the legacy MetaMetrics cleanup (#26820) by aligning Assets token helpers and tests with
useAnalytics’s single-argumenttrackEvent.goToAddEvmTokenandremoveEvmTokenno longer typetrackEventwith an optionalsaveDataRecordingsecond parameter—that API was never implemented on the hook.DeFiPositionsList.test.tsxandTokens/index.test.tsxdropsetSaveDataRecordingfrom mockedcreateEventBuilderchains 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.