From 96059ad2f7de9dbd08aeec6c6d36c132e2e3130e Mon Sep 17 00:00:00 2001 From: Karan Handa Date: Sat, 20 Jan 2024 13:30:59 +0530 Subject: [PATCH] remove redundant state --- apps/client/pages/_app.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/client/pages/_app.tsx b/apps/client/pages/_app.tsx index 0a4affac..ae4d14db 100644 --- a/apps/client/pages/_app.tsx +++ b/apps/client/pages/_app.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, type PropsWithChildren, type ReactElement } from 'react' +import { useEffect, type PropsWithChildren, type ReactElement } from 'react' import type { AppProps } from 'next/app' import { ErrorBoundary } from 'react-error-boundary' import { Analytics } from '@vercel/analytics/react' @@ -34,12 +34,10 @@ Sentry.init({ // Providers and components only relevant to a logged-in user const WithAuth = function ({ children }: PropsWithChildren) { const { data: session, status } = useSession() - const [isLoading, setLoading] = useState(true) const router = useRouter() useEffect(() => { - if (status === 'loading') return // Wait until the session status is not 'loading' - setLoading(false) + if (status === 'loading') return if (!session) { router.push('/login')