Skip to content

refactor: move analytics data deletion out of MetaMetrics (2/4 mobile-core-ux)#26023

Merged
NicolasMassart merged 3 commits intomainfrom
refactor/25767_Move_analytics_data_deletion_mobile-core-ux_split_2-4
Feb 13, 2026
Merged

refactor: move analytics data deletion out of MetaMetrics (2/4 mobile-core-ux)#26023
NicolasMassart merged 3 commits intomainfrom
refactor/25767_Move_analytics_data_deletion_mobile-core-ux_split_2-4

Conversation

@NicolasMassart
Copy link
Copy Markdown
Contributor

@NicolasMassart NicolasMassart commented Feb 12, 2026

Description

Part 2/4 of #25767Code owner: mobile-core-ux

Depends on: split 1-4 (mobile-platform) — must merge after it.

Switches DeleteMetaMetricsData component from useMetrics to the new useAnalyticsDataDeletion hook for deletion methods and useAnalytics for tracking. This decouples the Settings UI from the MetaMetrics singleton for data deletion concerns.

What changed:

  • DeleteMetaMetricsData.tsx — replaced useMetrics() with useAnalyticsDataDeletion() + useAnalytics(). No behavioural change.
  • MetaMetricsAndDataCollectionSection.test.tsx — simplified MetaMetrics mock by removing unused deletion method stubs.

Changelog

CHANGELOG entry: null

Related issues

participates to fix:

Manual testing steps

Feature: Delete MetaMetrics data from Settings

  Scenario: user views deletion status
    Given the user is on Settings > Security & Privacy > Delete MetaMetrics Data
    When the screen loads
    Then the current deletion status is displayed correctly

  Scenario: user initiates data deletion
    Given the user is on the Delete MetaMetrics Data screen
    When user taps the delete button
    Then a deletion regulation is created
    And the UI updates to reflect the pending deletion

Screenshots/Recordings

N/A — no visual changes, only hook wiring.

Before

N/A

After

N/A

Pre-merge author checklist

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
Primarily a wiring/refactor change around analytics deletion and test mocks, with no intended behavior change; risk is limited to potential miswiring of the deletion/status hook calls.

Overview
Updates DeleteMetaMetricsData to stop using useMetrics() and instead call useAnalyticsDataDeletion() for deletion/status APIs and useAnalytics() for event tracking (keeping the UI behavior the same, but removing direct coupling to the MetaMetrics singleton).

Cleans up MetaMetricsAndDataCollectionSection.test.tsx by simplifying the MetaMetrics mock and dropping unused data-deletion method stubs.

Written by Cursor Bugbot for commit cd03611. This will update automatically on new commits. Configure here.

…25767)

Use useAnalyticsDataDeletion hook for deletion methods and
useAnalytics for tracking. Remove useMetrics dependency.
Clean up unused MetaMetrics deletion mocks in section test.
@NicolasMassart NicolasMassart requested a review from a team as a code owner February 12, 2026 16:52
@NicolasMassart NicolasMassart self-assigned this Feb 12, 2026
@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.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Feb 12, 2026
@NicolasMassart NicolasMassart added team-mobile-ux Mobile UX team and removed team-mobile-platform Mobile Platform team labels Feb 12, 2026
@NicolasMassart NicolasMassart marked this pull request as draft February 12, 2026 17:08
@NicolasMassart NicolasMassart added the DO-NOT-MERGE Pull requests that should not be merged label Feb 12, 2026
@NicolasMassart
Copy link
Copy Markdown
Contributor Author

wait for #26022 to merge

@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: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are a pure internal refactoring of the DeleteMetaMetricsData component in the Security Settings section. The refactoring replaces the deprecated useMetrics hook with two new hooks: useAnalyticsDataDeletion (for data deletion functions) and useAnalytics (for analytics tracking).

Key observations:

  1. No user-facing behavior changes - the component still provides the same functionality
  2. No UI changes - only internal hook usage is modified
  3. The test file changes are just simplifying mocks to match the new hook structure
  4. No E2E tests exist for the MetaMetrics data deletion feature (confirmed by searching the codebase)
  5. The hooks provide identical functionality to what was previously available through useMetrics

This is a low-risk internal code organization change that doesn't require E2E test validation.

Performance Test Selection:
This is a pure refactoring change that replaces one hook with two equivalent hooks. There are no changes to UI rendering, data loading, state management, or any performance-critical paths. The hooks provide the same functionality with the same implementation patterns (useMemo for stable references). No performance impact is expected.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@NicolasMassart NicolasMassart added the Code Impact - Medium Average task code change that can relatively safely being applied to the codebase label Feb 13, 2026
@NicolasMassart NicolasMassart marked this pull request as ready for review February 13, 2026 19:35
@NicolasMassart NicolasMassart added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit c0aa877 Feb 13, 2026
58 checks passed
@NicolasMassart NicolasMassart deleted the refactor/25767_Move_analytics_data_deletion_mobile-core-ux_split_2-4 branch February 13, 2026 20:08
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2026
@metamaskbot metamaskbot added the release-7.67.0 Issue or pull request that will be included in release 7.67.0 label Feb 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Code Impact - Medium Average task code change that can relatively safely being applied to the codebase release-7.67.0 Issue or pull request that will be included in release 7.67.0 size-S team-mobile-ux Mobile UX team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants