From a5522c98a0b936ab5e7856c71f03d86a41a4c97a Mon Sep 17 00:00:00 2001 From: Bailey Pumfleet Date: Mon, 11 Apr 2022 16:11:35 +0100 Subject: [PATCH] Revert "Fixes public apps page (#2422)" (#2461) This reverts commit 81f3e824ff2d52e740054daffb2bc263e8ea3788. --- apps/web/components/Shell.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/web/components/Shell.tsx b/apps/web/components/Shell.tsx index a9ece1da..2464f0f7 100644 --- a/apps/web/components/Shell.tsx +++ b/apps/web/components/Shell.tsx @@ -57,10 +57,9 @@ function useRedirectToLoginIfUnauthenticated() { const { data: session, status } = useSession(); const loading = status === "loading"; const router = useRouter(); - const shouldDisplayUnauthed = router.pathname.startsWith("/apps"); useEffect(() => { - if (shouldDisplayUnauthed) { + if (router.pathname.startsWith("/apps")) { return; } @@ -77,7 +76,6 @@ function useRedirectToLoginIfUnauthenticated() { return { loading: loading && !session, - shouldDisplayUnauthed, session, }; } @@ -136,7 +134,7 @@ export default function Shell(props: { }) { const { t } = useLocale(); const router = useRouter(); - const { loading, shouldDisplayUnauthed } = useRedirectToLoginIfUnauthenticated(); + const { loading, session } = useRedirectToLoginIfUnauthenticated(); const { isRedirectingToOnboarding } = useRedirectToOnboardingIfNeeded(); const telemetry = useTelemetry(); @@ -209,7 +207,7 @@ export default function Shell(props: { ); } - if (!shouldDisplayUnauthed) return null; + if (!session) return null; return ( <>