Conversation
Copilot
AI
changed the title
[WIP] Fix pendingConfirmationsSortedSelector for memoization
Fix Jan 16, 2026
pendingConfirmationsSortedSelector memoization (P0 re-render fix)
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Contributor
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (2 files, +68 -10)
|
Contributor
Builds ready [17e7876]
UI Startup Metrics (1304 ± 114 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
17e7876 to
bc11830
Compare
pendingConfirmationsSortedSelector memoization (P0 re-render fix)pendingConfirmationsSortedSelector broken memoization causes global cascading re-renders
pendingConfirmationsSortedSelector broken memoization causes global cascading re-renderspendingConfirmationsSortedSelector broken selector memoization to prevent global cascading re-renders
Contributor
Builds ready [bc11830]
UI Startup Metrics (1299 ± 108 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Contributor
Builds ready [9772af4]
UI Startup Metrics (1270 ± 111 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
Contributor
Builds ready [f542ff5]
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
f542ff5 to
9772af4
Compare
Contributor
Builds ready [9772af4]
UI Startup Metrics (1294 ± 95 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚀 Bundle size reduced!]
|
Contributor
Builds ready [9772af4]
UI Startup Metrics (1294 ± 95 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚀 Bundle size reduced!]
|
Contributor
Builds ready [88f2be0]
UI Startup Metrics (1292 ± 102 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
OGPoyraz
approved these changes
Jan 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixed
pendingConfirmationsSortedSelectorto use proper memoization withcreateSelector. This selector was creating new arrays on every call, breaking memoization and triggering cascade re-renders throughout the confirmation flow and Routes components.What is the reason for the change?
The selector was implemented as a plain function that returned new array references on every invocation (via
.filter()and.sort()), causing unnecessary re-renders in all dependent components even when the underlying state hadn't changed.What is the improvement/solution?
Wrapped the selector with
createSelectorfrom reselect to memoize the transformation. Now the selector only recalculates whengetPendingApprovalsreturns a different reference, preventing cascade re-renders and improving performance across the confirmation flow.Changelog
CHANGELOG entry: Fixed critical performance issue slowing down all user actions by fixing confirmations selector memoization
Related issues
Fixes: Part of P0 effort to break global re-render cascade (#6669)
Manual testing steps
Screenshots/Recordings
N/A - This is a performance optimization with no visual changes. The improvement is verified through unit tests that confirm the selector returns the same reference when state is unchanged.
Before
Selector created new arrays on every call, causing unnecessary re-renders:
After
Selector uses memoization to return stable references:
Pre-merge author checklist
Pre-merge reviewer checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Note
Improves selector performance and adds tests around confirmation sorting/filtering.
pendingConfirmationsSortedSelectorwithreselectusinggetPendingApprovals, preserving sort-by-time and confirmation-type filtering while returning stable referencesoldestPendingConfirmationSelectorbehavior validatedWritten by Cursor Bugbot for commit 88f2be0. This will update automatically on new commits. Configure here.