Commit 159d9ed
chore(analytics): drop saveDataRecording from Tokens util + sweep assets test mocks (#31990)
## **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**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [x] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!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.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
bf7b2a1. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 87e58f8 commit 159d9ed
4 files changed
Lines changed: 2 additions & 10 deletions
File tree
- app/components/UI
- DeFiPositions
- Tokens
- util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
595 | | - | |
596 | 595 | | |
597 | 596 | | |
598 | 597 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
326 | 325 | | |
327 | 326 | | |
328 | 327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 10 | + | |
14 | 11 | | |
15 | 12 | | |
16 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
19 | 16 | | |
20 | 17 | | |
21 | 18 | | |
| |||
0 commit comments