MetaMask / MetaMask/metamask-extension

[P1] selectors: extract preferences + feature flags

Open
#44,567 1 comment 0 reactions 0 assignees View on GitHub
exalate-duplicate INVALID-ISSUE-TEMPLATE mig-epic-71-child team-extension-platform
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

**Parent Epic:** [#44566 — `selectors.js` decomposition](https://github.com/MetaMask/metamask-extension/issues/44566)
**Source:** `ui/selectors/selectors.js`
**Size:** L

---

## Problem

~34 settings/flag selectors (`getShowTestNetworks`, `getPrivacyMode`, `getUseTokenDetection`, `getUseNftDetection`, `getTheme`, `getUsePhishDetect`, `getUseCurrencyRateCheck`, `getFeatureFlags`, `getIsRpcFailoverEnabled`, … + many `getIs*Enabled`) read only external `getPreferences`/`getRemoteFeatureFlags`. Effectively zero intra-file coupling.

## Solution

Create `ui/selectors/preferences.ts` and move them. Cheapest big win; unblocks nothing-dependent conversion. (Do not split remote-flags into a separate micro-module — keep one `preferences.ts`.)

Migration seam (no barrel): repoint every site importing the moved selectors to `ui/selectors/` directly (a `ts-morph` codemod that splits any `../selectors` barrel imports into per-module imports) and delete them from `selectors.js` in the same PR — no re-export facade, per the no-barrel-files convention.

## Acceptance Criteria

- [ ] `preferences.ts` with the ~34 selectors; imports repointed directly to the module (no barrel). Tests green.

Contributor guide

Open the contributing guide

Research direction

Start in ui/selectors/selectors.js and identify the listed preference and feature-flag selectors that read getPreferences or getRemoteFeatureFlags. Create ui/selectors/preferences.ts, then locate every import of the moved selectors and repoint it directly to the relevant module without a barrel. Done means the selectors are removed from selectors.js, preferences.ts contains the ~34 selectors, and tests are green.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.