-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Consistent confirmation navigation #27326
Conversation
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. |
@@ -28,15 +28,9 @@ export function pendingConfirmationsSortedSelector( | |||
.sort((a1, a2) => a1.time - a2.time); | |||
} | |||
|
|||
const internalLatestPendingConfirmationSelector = createSelector( | |||
export const oldestPendingConfirmationSelector = createSelector( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we definitely want to remove the createDeepEqualSelector
here?
The recent Redux state PR should only update pendingApprovals
when it actually changes, but if it does, then we'll get a fresh object reference and re-fire here unnecessarily?
These selectors are critical since they can impact everything using useConfirmContext
.
8586fa8
to
0a6a568
Compare
Builds ready [0a6a568]
Page Load Metrics (1753 ± 67 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
@@ -21,22 +20,16 @@ export function pendingConfirmationsSelector(state: ConfirmMetamaskState) { | |||
export function pendingConfirmationsSortedSelector( | |||
state: ConfirmMetamaskState, | |||
) { | |||
return getPendingApprovals(state) | |||
return Object.values(state.metamask.pendingApprovals ?? {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no value in doing this yet as we're not using createSelector
so we'll always generate a new reference anyway, but at least we can re-use getPendingApprovals
.
74d514e
to
8e9da4f
Compare
Quality Gate passedIssues Measures |
Builds ready [8e9da4f]
Page Load Metrics (1945 ± 120 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Description
As per the way the old confirmation navigation works, when submitting multiple confirmation requests to the wallet, we want to select the oldest confirmation by default (1 of X).
If
paramsTransactionId
is undefined inui/pages/confirmations/hooks/syncConfirmPath.ts
, the default confirmation id comes fromcurrentConfirmation
. As such, the firstcurrentConfirmation
selected inuseCurrentConfirmation
will determine the default position in the array of X sorted confirmations.Instead of using latestPendingApproval, we want to use the oldest (first to be created) one.
Related issues
Fixes: #27252
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist