diff --git a/src/app/components/accountHeader/index.tsx b/src/app/components/accountHeader/index.tsx index f56e3a2fd..22414a68e 100644 --- a/src/app/components/accountHeader/index.tsx +++ b/src/app/components/accountHeader/index.tsx @@ -1,7 +1,7 @@ import AccountRow from '@components/accountRow'; import useWalletReducer from '@hooks/useWalletReducer'; import { useTranslation } from 'react-i18next'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; import styled from 'styled-components'; import OptionsDialog from '@components/optionsDialog/optionsDialog'; @@ -64,7 +64,6 @@ function AccountHeaderComponent({ disableAccountSwitch = false, }: Props) { const navigate = useNavigate(); - const { pathname } = useLocation(); const selectedAccount = useSelectedAccount(); const menuDialog = useOptionsDialog(); @@ -75,7 +74,7 @@ function AccountHeaderComponent({ const handleAccountSelect = () => { if (!disableAccountSwitch) { - navigate(RoutePaths.AccountList, { state: { from: pathname } }); + navigate(RoutePaths.AccountList); } }; diff --git a/src/app/components/animatedScreenContainer/index.tsx b/src/app/components/animatedScreenContainer/index.tsx index c915c526d..9b102ca73 100644 --- a/src/app/components/animatedScreenContainer/index.tsx +++ b/src/app/components/animatedScreenContainer/index.tsx @@ -1,7 +1,6 @@ import ScreenContainer from '@components/screenContainer'; import { animated, useSpring } from '@react-spring/web'; import { ANIMATION_EASING } from '@utils/constants'; -import { useLocation } from 'react-router-dom'; const containerStyles = { display: 'flex', @@ -12,10 +11,9 @@ const containerStyles = { }; function AnimatedScreenContainer(): JSX.Element { - const location = useLocation(); - const { state } = location; - - const shouldAnimate = state?.from === '/login'; + // TODO: figure this out to make animations work + // TODO: they should only load if coming fromm the login page + const shouldAnimate = false; const styles = useSpring({ from: { diff --git a/src/app/components/guards/auth.tsx b/src/app/components/guards/auth.tsx index 566b4f066..15f7d345e 100644 --- a/src/app/components/guards/auth.tsx +++ b/src/app/components/guards/auth.tsx @@ -3,7 +3,7 @@ import useWalletReducer from '@hooks/useWalletReducer'; import useWalletSelector from '@hooks/useWalletSelector'; import Spinner from '@ui-library/spinner'; import { useEffect, type PropsWithChildren } from 'react'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; import styled from 'styled-components'; const CenterChildContainer = styled.div` @@ -24,7 +24,6 @@ const isInitialised = { function AuthGuard({ children }: PropsWithChildren) { const navigate = useNavigate(); - const { pathname } = useLocation(); const { encryptedSeed, isUnlocked, accountsList } = useWalletSelector(); const { loadWallet, lockWallet } = useWalletReducer(); const seedVault = useSeedVault(); @@ -41,7 +40,7 @@ function AuthGuard({ children }: PropsWithChildren) { if (encryptedSeed) { // this is a legacy seed store. If it exists, we need to migrate // it to the new seed vault which happens on login - navigate('/login', { state: { from: pathname } }); + navigate('/login'); return; } @@ -64,7 +63,7 @@ function AuthGuard({ children }: PropsWithChildren) { try { await seedVault.getSeed(); } catch (error) { - navigate('/login', { state: { from: pathname } }); + navigate('/login'); return; } diff --git a/src/app/screens/connect/authenticationRequest/index.tsx b/src/app/screens/connect/authenticationRequest/index.tsx index b6610278b..abd3bfe40 100644 --- a/src/app/screens/connect/authenticationRequest/index.tsx +++ b/src/app/screens/connect/authenticationRequest/index.tsx @@ -220,7 +220,7 @@ function AuthenticationRequest() { stxAddress: { mainnet: selectedAccount.stxAddress, testnet: publicKeyToAddress(AddressVersion.MainnetSingleSig, { - data: Buffer.from(selectedAccount.stxPublicKey, 'hex'), + data: Uint8Array.from(Buffer.from(selectedAccount.stxPublicKey, 'hex')), type: StacksMessageType.PublicKey, }), }, diff --git a/src/app/screens/connect/btcSelectAddressScreen/index.tsx b/src/app/screens/connect/btcSelectAddressScreen/index.tsx index 9548dbd95..c7b5be05d 100644 --- a/src/app/screens/connect/btcSelectAddressScreen/index.tsx +++ b/src/app/screens/connect/btcSelectAddressScreen/index.tsx @@ -14,7 +14,7 @@ import { trackMixPanel } from '@utils/mixpanel'; import RoutePaths from 'app/routes/paths'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; import AddressPurposeBox from '../addressPurposeBox'; import PermissionsList from '../permissionsList'; import { @@ -34,7 +34,6 @@ import useBtcAddressRequest from './useBtcAddressRequest'; function BtcSelectAddressScreen() { const [loading, setLoading] = useState(false); const navigate = useNavigate(); - const { pathname } = useLocation(); const { t } = useTranslation('translation', { keyPrefix: 'SELECT_BTC_ADDRESS_SCREEN' }); const selectedAccount = useSelectedAccount(); const { network } = useWalletSelector(); diff --git a/src/app/screens/login/index.tsx b/src/app/screens/login/index.tsx index 40819714f..025555513 100644 --- a/src/app/screens/login/index.tsx +++ b/src/app/screens/login/index.tsx @@ -11,7 +11,7 @@ import Button from '@ui-library/button'; import { trackMixPanel } from '@utils/mixpanel'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { useLocation, useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; import { AppVersion, ButtonContainer, @@ -31,7 +31,6 @@ import { function Login(): JSX.Element { const { t } = useTranslation('translation', { keyPrefix: 'LOGIN_SCREEN' }); const navigate = useNavigate(); - const { state } = useLocation(); const { unlockWallet } = useWalletReducer(); const { hasSeed } = useSeedVault(); const { migrateCachedStorage, isVaultUpdated } = useSeedVaultMigration(); @@ -89,19 +88,11 @@ function Login(): JSX.Element { setShowMigration(true); } else { setIsVerifying(false); - if (state?.from) { - navigate(state?.from, { state: { from: '/login' } }); // this is needed for AnimatedScreenContainer where we check the state.from - } else { - navigate(-1); - } + navigate(-1); } } catch (err) { setIsVerifying(false); - if (state?.from) { - navigate(state?.from, { state: { from: '/login' } }); // this is needed for AnimatedScreenContainer where we check the state.from - } else { - navigate(-1); - } + navigate(-1); } };