diff --git a/ui/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js b/ui/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js index fe201a507792..6acfd71eb160 100755 --- a/ui/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js +++ b/ui/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js @@ -5,10 +5,14 @@ import PropTypes from 'prop-types'; import { getCurrentChainId, getUnapprovedTransactions, + unconfirmedMessagesHashSelector, } from '../../../../selectors'; import { transactionMatchesNetwork } from '../../../../../shared/modules/transaction.utils'; import { I18nContext } from '../../../../contexts/i18n'; -import { CONFIRM_TRANSACTION_ROUTE } from '../../../../helpers/constants/routes'; +import { + CONFIRM_TRANSACTION_ROUTE, + SIGNATURE_REQUEST_PATH, +} from '../../../../helpers/constants/routes'; import { clearConfirmTransaction } from '../../../../ducks/confirm-transaction/confirm-transaction.duck'; import { hexToDecimal } from '../../../../../shared/lib/metamask-controller-utils'; @@ -18,8 +22,10 @@ const ConfirmPageContainerNavigation = ({ txData }) => { const history = useHistory(); const unapprovedTxs = useSelector(getUnapprovedTransactions); + const unconfirmedMessages = useSelector(unconfirmedMessagesHashSelector); const currentChainId = useSelector(getCurrentChainId); const network = hexToDecimal(currentChainId); + const isUnapprovedTxsEmpty = Object.keys(unapprovedTxs).length === 0; const currentNetworkUnapprovedTxs = Object.keys(unapprovedTxs) .filter((key) => @@ -27,7 +33,9 @@ const ConfirmPageContainerNavigation = ({ txData }) => { ) .reduce((acc, key) => ({ ...acc, [key]: unapprovedTxs[key] }), {}); - const enumUnapprovedTxs = Object.keys(currentNetworkUnapprovedTxs); + const enumUnapprovedTxs = Object.keys( + isUnapprovedTxsEmpty ? unconfirmedMessages : currentNetworkUnapprovedTxs, + ); const currentPosition = enumUnapprovedTxs.indexOf( txData.id ? txData.id.toString() : '', ); @@ -43,7 +51,11 @@ const ConfirmPageContainerNavigation = ({ txData }) => { const onNextTx = (txId) => { if (txId) { dispatch(clearConfirmTransaction()); - history.push(`${CONFIRM_TRANSACTION_ROUTE}/${txId}`); + history.push( + isUnapprovedTxsEmpty + ? `${CONFIRM_TRANSACTION_ROUTE}/${txId}${SIGNATURE_REQUEST_PATH}` + : `${CONFIRM_TRANSACTION_ROUTE}/${txId}`, + ); } }; diff --git a/ui/components/app/signature-request-original/__snapshots__/signature-request-original.test.js.snap b/ui/components/app/signature-request-original/__snapshots__/signature-request-original.test.js.snap index 38b691b7d563..1006d738dcc8 100644 --- a/ui/components/app/signature-request-original/__snapshots__/signature-request-original.test.js.snap +++ b/ui/components/app/signature-request-original/__snapshots__/signature-request-original.test.js.snap @@ -5,6 +5,76 @@ exports[`SignatureRequestOriginal should match snapshot 1`] = `
+
+ +