Skip to content

Commit

Permalink
temp disable useLayoutEffect for nav to work
Browse files Browse the repository at this point in the history
  • Loading branch information
timpau committed Mar 19, 2024
1 parent 37b3d34 commit c68eea4
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions frontend/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ function useRedirect(isVersionChecked: boolean) {
const params = useSearchParams()

const router = useRouter()

// temp disable to get the nav working

// We will only redirect on the first load
useLayoutEffect(() => {
if (!isVersionChecked) return
// These pathnames are being loaded when we have to oauth with Discord
// We shouldn't be redirecting the user from these pages
if (pathname === '/discord-login' || pathname === '/discord-logout') return
// useLayoutEffect(() => {
// if (!isVersionChecked) return
// // These pathnames are being loaded when we have to oauth with Discord
// // We shouldn't be redirecting the user from these pages
// if (pathname === '/discord-login' || pathname === '/discord-logout') return

//RULES:
// 1. no last state -> redirect to welcome page
// 2. there is a last state -> redirect to that page
if (lastStep === null) router.replace('/')
if (lastStep) router.replace(lastStep)
}, [isVersionChecked, lastStep, router, pathname])
// //RULES:
// // 1. no last state -> redirect to welcome page
// // 2. there is a last state -> redirect to that page
// if (lastStep === null) router.replace('/')
// if (lastStep) router.replace(lastStep)
// }, [isVersionChecked, lastStep, router, pathname])

useEffect(() => {
if (!isVersionChecked) return
Expand Down

0 comments on commit c68eea4

Please sign in to comment.