From 74d514e9a3fba746317b6ac4d0d76972685daebf Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Tue, 24 Sep 2024 13:35:16 +0100 Subject: [PATCH] Address review feedback --- ui/pages/confirmations/selectors/confirm.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/pages/confirmations/selectors/confirm.ts b/ui/pages/confirmations/selectors/confirm.ts index 6f912b12d576..57107bdf3021 100644 --- a/ui/pages/confirmations/selectors/confirm.ts +++ b/ui/pages/confirmations/selectors/confirm.ts @@ -1,9 +1,10 @@ import { ApprovalType } from '@metamask/controller-utils'; +import { createSelector } from 'reselect'; import { getPendingApprovals } from '../../../selectors/approvals'; -import { ConfirmMetamaskState } from '../types/confirm'; -import { createDeepEqualSelector } from '../../../selectors/util'; import { getPreferences } from '../../../selectors/selectors'; +import { createDeepEqualSelector } from '../../../selectors/util'; +import { ConfirmMetamaskState } from '../types/confirm'; const ConfirmationApprovalTypes = [ ApprovalType.PersonalSign, @@ -27,11 +28,16 @@ export function pendingConfirmationsSortedSelector( .sort((a1, a2) => a1.time - a2.time); } -export const oldestPendingConfirmationSelector = createDeepEqualSelector( +const firstPendingConfirmationSelector = createSelector( pendingConfirmationsSortedSelector, (pendingConfirmations) => pendingConfirmations[0], ); +export const oldestPendingConfirmationSelector = createDeepEqualSelector( + firstPendingConfirmationSelector, + (firstPendingConfirmation) => firstPendingConfirmation, +); + // eslint-disable-next-line @typescript-eslint/no-explicit-any export function getIsRedesignedConfirmationsDeveloperEnabled(state: any) { return getPreferences(state).isRedesignedConfirmationsDeveloperEnabled;