MetaMask / MetaMask/metamask-extension

[State Sync Redesign 3.13] Remove `metamask` Redux slice

Open
#40,050 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

Remove the monolithic `metamask` Redux slice entirely. Retain Redux for UI-local slices (`appState`, `confirm`, `history`, etc.).

## Steps

1. Remove `metamask` reducer from Redux store configuration
2. Delete `shared/types/background.ts` and `shared/types/background.spec.ts`
3. Remove `FlattenedBackgroundStateProxy` re-export from `shared/types/index.ts`
4. Migrate consumers of `FlattenedBackgroundStateProxy` to direct controller state type imports:
- `app/scripts/controllers/metametrics-controller.ts` — replace `MetaMaskState` type with `Pick` from individual controller state types (`PreferencesControllerState`, `NetworkState`, `AccountsControllerState`, etc.)
- `app/scripts/lib/rpc-method-middleware/handlers/request-accounts.ts` — replace `Pick` with `Pick` from `MetaMetricsControllerState`, `PermissionLogControllerState`, `PreferencesControllerState`
5. Remove `state.metamask` references from any remaining code
6. Retain Redux for UI-local slices (`appState`, `confirm`, `history`, etc.)
7. Update `handleStartUISync` in `app/scripts/ui.js` / `ui/index.js` to initialize `ControllerStateManager` from keyed initial state (instead of passing flat state to Redux preloaded state)
8. Update `setupInitialStore` — remove `metamask: metamaskState` from preloaded Redux state; `ControllerStateManager` owns this data now

## Files

- `shared/types/background.ts` (delete)
- `shared/types/background.spec.ts` (delete)
- `shared/types/index.ts` (remove re-export)
- `app/scripts/controllers/metametrics-controller.ts` (migrate types)
- `app/scripts/lib/rpc-method-middleware/handlers/request-accounts.ts` (migrate types)
- `ui/ducks/metamask/metamask.js` (delete)
- `ui/store/store.ts`
- `ui/index.js`
- `app/scripts/ui.js`

## Dependencies

Issues 3.10, 3.11, 3.12 (Sentry, state logs, and Storybook must be updated first)

## Context

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

Contributor guide

Open the contributing guide

Research direction

Review prerequisite issues 3.10, 3.11, and 3.12 first, then inspect ui/store/store.ts, ui/index.js, app/scripts/ui.js, and the listed controller and RPC handler files. Trace remaining state.metamask and FlattenedBackgroundStateProxy references before removing the Redux slice and background types. Done means ControllerStateManager owns keyed initial state, Redux retains only UI-local slices, and the named files and references are updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.