Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

272
Visualizações
Next-Auth: Why are there network requests with "useSession" on the client

I'm currently using next-auth for authentication. I have a piece of code that checks whether a session exists and renders a "signout" button based on that (this page is also SSG):

 {session && (
          <li>
            <Link href="/api/auth/signOut">
              <a
                onClick={(e) => {
                  e.preventDefault();
                  signOut();
                }}
              >
                Sign Out
              </a>
            </Link>
          </li>
        )}

However, when I do this, I see a flicker in my nav bar. I would think that there shouldn't be a flicker since the client already knows whether the session exists.

I've looked at the network requests, and I see that a request is made every time I reload the page. Why is this request necessary? Shouldn't the client already know whether a session exists or not without having to make a request?

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda