@@ -46,19 +46,19 @@ import {
4646import cn from 'classnames'
4747import { Formik , useField , useFormikContext } from 'formik'
4848import { useDispatch , useSelector } from 'react-redux'
49+ import { useNavigate , useLocation } from 'react-router'
4950import { useLocalStorage } from 'react-use'
5051import { z } from 'zod'
5152import { toFormikValidationSchema } from 'zod-formik-adapter'
5253
53- import { useHistoryContext } from 'app/HistoryProvider'
5454import * as signOnActions from 'common/store/pages/signon/actions'
5555import ModalDrawer from 'components/modal-drawer/ModalDrawer'
5656import { ModalForm } from 'components/modal-form/ModalForm'
5757import { USDCManualTransfer } from 'components/usdc-manual-transfer/USDCManualTransfer'
5858import { useIsMobile } from 'hooks/useIsMobile'
5959import { useIsUSDCEnabled } from 'hooks/useIsUSDCEnabled'
6060import { useManagedAccountNotAllowedCallback } from 'hooks/useManagedAccountNotAllowedRedirect'
61- import { pushUniqueRoute } from 'utils/route'
61+ import { getPathname } from 'utils/route'
6262import zIndex from 'utils/zIndex'
6363
6464import styles from './PremiumContentPurchaseModal.module.css'
@@ -113,7 +113,8 @@ const PremiumContentPurchaseForm = (props: PremiumContentPurchaseFormProps) => {
113113 const currentPageIndex = pageToPageIndex ( page )
114114
115115 const { submitForm, resetForm } = useFormikContext ( )
116- const { history } = useHistoryContext ( )
116+ const navigate = useNavigate ( )
117+ const location = useLocation ( )
117118 const { data : isAccountComplete = false } = useCurrentAccountUser ( {
118119 select : selectIsAccountComplete
119120 } )
@@ -126,9 +127,12 @@ const PremiumContentPurchaseForm = (props: PremiumContentPurchaseFormProps) => {
126127 // Navigate to track on successful purchase behind the modal
127128 useEffect ( ( ) => {
128129 if ( stage === PurchaseContentStage . FINISH && permalink ) {
129- dispatch ( pushUniqueRoute ( history . location , permalink ) )
130+ const pathname = getPathname ( location )
131+ if ( permalink !== pathname ) {
132+ navigate ( permalink )
133+ }
130134 }
131- } , [ stage , permalink , dispatch , history ] )
135+ } , [ stage , permalink , navigate , location ] )
132136
133137 const handleUSDCManualTransferClose = useCallback ( ( ) => {
134138 dispatch ( setPurchasePage ( { page : PurchaseContentPageType . PURCHASE } ) )
0 commit comments