Skip to content

Commit

Permalink
fix: onboarding route flashing
Browse files Browse the repository at this point in the history
  • Loading branch information
fbwoolf committed Dec 14, 2021
1 parent 297afa8 commit b2e478b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/routes/app-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Navigate, Route, Routes, useLocation, useNavigate } from 'react-router-

import { useAnalytics } from '@common/hooks/analytics/use-analytics';
import { useWallet } from '@common/hooks/use-wallet';
import { getViewMode } from '@common/utils';
import { Container } from '@components/container/container';
import { MagicRecoveryCode } from '@pages/onboarding/magic-recovery-code/magic-recovery-code';
import { ChooseAccount } from '@pages/choose-account/choose-account';
Expand Down Expand Up @@ -30,9 +31,12 @@ export function AppRoutes(): JSX.Element | null {
const analytics = useAnalytics();
useSaveAuthRequest();

const mode = getViewMode();

useEffect(() => {
// This ensures the ext popup hits the right route on load
if (pathname === RouteUrls.Home && !hasGeneratedWallet) navigate(RouteUrls.Onboarding);
if (mode === 'popup' && pathname === RouteUrls.Home && !hasGeneratedWallet)
navigate(RouteUrls.Onboarding);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Expand Down

0 comments on commit b2e478b

Please sign in to comment.