Skip to content

Commit

Permalink
Fix E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwalsh0 committed Dec 9, 2024
1 parent db5cdf9 commit 3d66d7f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 5 additions & 4 deletions ui/pages/confirmations/components/confirm/nav/nav.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useCallback } from 'react';

import { useDispatch } from 'react-redux';
import { QueueType } from '../../../../../../shared/constants/metametrics';
import {
Box,
Expand Down Expand Up @@ -35,9 +36,9 @@ export type NavProps = {

export const Nav = ({ confirmationId }: NavProps) => {
const t = useI18nContext();
const dispatch = useDispatch();

const { confirmations, count, getIndex, navigateToIndex } =
useConfirmationNavigation();
const { count, getIndex, navigateToIndex } = useConfirmationNavigation();

const position = getIndex(confirmationId);

Expand All @@ -49,8 +50,8 @@ export const Nav = ({ confirmationId }: NavProps) => {
);

const onRejectAll = useCallback(async () => {
await rejectAllApprovals();
}, [confirmations]);
await dispatch(rejectAllApprovals());
}, [dispatch]);

useQueuedConfirmationsEvent(QueueType.NavigationHeader);

Expand Down
12 changes: 10 additions & 2 deletions ui/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5304,8 +5304,16 @@ export function requestUserApproval({
};
}

export async function rejectAllApprovals() {
await submitRequestToBackground('rejectAllApprovals');
export function rejectAllApprovals() {
return async (dispatch: MetaMaskReduxDispatch) => {
await submitRequestToBackground('rejectAllApprovals');

const { pendingApprovals } = await forceUpdateMetamaskState(dispatch);

if (Object.values(pendingApprovals).length === 0) {
dispatch(closeCurrentNotificationWindow());
}
};
}

export async function getCurrentNetworkEIP1559Compatibility(): Promise<
Expand Down

0 comments on commit 3d66d7f

Please sign in to comment.