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
What is this about?
getMemoizedInterfacesandgetMemoizedInterfacearecreateDeepEqualSelectorwrappers whosegetMemoized*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, plaincreateSelectorsuffices 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 === nextfor the input slice across two unrelated dispatches (the reference-stability contract test). Stable: downgrade both tocreateSelectorand delete thegetMemoizedprefix. 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
References
app/selectors/snaps/interfaceController.ts:27,43mms-performancesweep recipes added in perf: Augmentmms-performancewith frontend learnings from the Extension performance audit skills#49 (mm-selector-cascade— band-aid sweep)