Next.js Discord

Discord Forum

After redirect, my page refreshes itself once

Unanswered
Tricolored Heron posted this in #help-forum
Open in Discord
Tricolored HeronOP
Hi all,

I seem to have a weird issue.

On my root page.tsx I check whether a user is logged in, and if so, I redirect them to the internal landing page like so:

const RootPage = () => {
  const session = await getServerSession();

  if (session) {
    redirect('/feed', 'replace');
  }

  return <LandingPage />
}


The redirect itself works, however, once it has loaded the Feed, the page then visibly refreshes itself. I simply have no clue why!!!

If I go to the Feed directly (via url) it doesn't refresh itself..

Has anyone got a clue why?

1 Reply

Tricolored HeronOP
I am experimenting with it, and it's the same behaviour no matter which page I direct to. I've also made sure I've not got any other redirects or refreshes anywhere.