Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronfigueiredo committed Sep 23, 2024
1 parent cfdb159 commit 0a6a568
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ui/pages/confirmations/selectors/confirm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
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';
Expand All @@ -21,14 +20,14 @@ export function pendingConfirmationsSelector(state: ConfirmMetamaskState) {
export function pendingConfirmationsSortedSelector(
state: ConfirmMetamaskState,
) {
return getPendingApprovals(state)
return Object.values(state.metamask.pendingApprovals ?? {})
.filter(({ type }) =>
ConfirmationApprovalTypes.includes(type as ApprovalType),
)
.sort((a1, a2) => a1.time - a2.time);
}

export const oldestPendingConfirmationSelector = createSelector(
export const oldestPendingConfirmationSelector = createDeepEqualSelector(
pendingConfirmationsSortedSelector,
(pendingConfirmations) => pendingConfirmations[0],
);
Expand Down

0 comments on commit 0a6a568

Please sign in to comment.