MetaMask / MetaMask/metamask-extension

[State Sync Redesign 3.3] Migrate one PreferencesController component (MVP validation)

Open
#40,040 0 comments 0 reactions 0 assignees View on GitHub
INVALID-ISSUE-TEMPLATE team-extension-platform
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

Pick one component that reads a single PreferencesController property via `useSelector`. Replace with `useControllerState('PreferencesController', (s) => s.preferences)`.

## Steps

1. Identify a component with a single PreferencesController selector (no cross-controller deps)
2. Replace `useSelector` call with `useControllerState`
3. Update the component's test to use `renderWithControllerState`
4. Validate via React DevTools profiler: component does NOT re-render when other controllers change

## MVP validation criteria

- [ ] Component renders correctly from per-controller store
- [ ] Component does NOT re-render when unrelated controllers change (profiler evidence)
- [ ] Existing tests pass (dual-write ensures Redux path unchanged)
- [ ] No new warnings in the console
- [ ] Test auto-mapping works (flat mock state → controller-keyed)

## Risk

Low — one component, dual-write means Redux path still works for everything else.

## Dependencies

Issues 3.1, 3.2

## Context

Part of [State Sync Redesign — Epic 3: UI-controller subscriptions]. MVP validation.

Contributor guide

Open the contributing guide

Research direction

Start by locating a component that reads one PreferencesController property through useSelector, with no cross-controller dependencies. Replace that selector with useControllerState('PreferencesController', ...), update its test to use renderWithControllerState, and validate the existing tests plus React DevTools profiler. Done means correct rendering, no re-render for unrelated controller changes, automatic mock-state mapping, and no new console warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, redux, typescript
Domain
frontend, testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.