MetaMask / MetaMask/metamask-extension
[P2] selectors: extract ephemeral UI / modal state selectors
- 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:** M
---
## Problem
~15 ephemeral UI-state reads (`getAppIsLoading`, `getSlides`, `getShowRecoveryPhraseReminder`, `getShowTermsOfUse`, `getShowOutdatedBrowserWarning`, `getShowUpdateModal`, `getPendingRedirectRoute`, `getDeferredDeepLink*`, …) + version helpers `versionToComparable`/`isExtensionVersionNewer`. Low coupling (a couple read `getRemoteFeatureFlags`/`UTM_PARAMETERS`).
## Solution
Create `ui/selectors/app-ui-state.ts`; route modal/slide selectors that fit into the existing `home-modals.ts`/`toast.ts` instead of duplicating.
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
- [ ] `app-ui-state.ts` (+ any fits into home-modals/toast); imports repointed directly to the module (no barrel). Tests green.
Contributor guide
Research direction
Start with ui/selectors/selectors.js and identify the listed ephemeral UI-state and version-helper selectors, then inspect ui/selectors/home-modals.ts and ui/selectors/toast.ts for selectors that fit there. Create ui/selectors/app-ui-state.ts, repoint importing sites directly to the domain modules without a barrel, and run the test suite to confirm all 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