MetaMask / MetaMask/metamask-mobile

Remove `getMemoizedInterface(s)` deep-equal wrappers in `interfaceController` once input stability is verified

Open
#31,497 1 comment 0 reactions 0 assignees View on GitHub
area-performance INVALID-ISSUE-TEMPLATE Sev3 ta-triaged
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

> **Performance audit finding** · Severity: **Low** · Effort: Easy · Fix risk: Simple · Test safety net: Partial
> Owner: CODEOWNERS best-effort (snaps)
> File: `app/selectors/snaps/interfaceController.ts:27,43`

### What is this about?

`getMemoizedInterfaces` and `getMemoizedInterface` are `createDeepEqualSelector` wrappers whose `getMemoized*` naming marks them as band-aids added downstream of unstable inputs. Deep-equal selectors run a deep comparison on every evaluation; if the underlying input slice is reference-stable when unchanged, plain `createSelector` suffices and the deep compares are pure overhead. If the input genuinely is replaced wholesale, the wrapper is justified — verify which contract holds before changing anything.

### Technical Details

Log `prev === next` for the input slice across two unrelated dispatches (the reference-stability contract test). Stable: downgrade both to `createSelector` and delete the `getMemoized` prefix. Unstable: keep, and document why at the definition so the next audit doesn't re-flag it. `getMemoizedInternalAccountByAddress` (the third wrapper found by the sweep) is filed separately with a different fix: #31491.

### Acceptance Criteria

- Contract verified and recorded; wrappers downgraded or annotated accordingly.

### References

- File: `app/selectors/snaps/interfaceController.ts:27,43`
- Source: `mms-performance` sweep recipes added in MetaMask/skills#49 (`mm-selector-cascade` — band-aid sweep)
- Status: **UNVALIDATED** (static evidence)

Contributor guide

Open the contributing guide

Research direction

Start in app/selectors/snaps/interfaceController.ts at lines 27 and 43, and inspect the inputs to getMemoizedInterfaces and getMemoizedInterface. Verify input reference stability across two unrelated dispatches, recording the contract; done means either replacing both wrappers with createSelector and removing the prefixes, or documenting why the wrappers remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.