Next.js Discord

Discord Forum

Nextjs Page Server Component is caching data

Unanswered
Siberian posted this in #help-forum
Open in Discord
SiberianOP
Hi there. I am trying to get firebase working, but whenever I Login -> Logout -> Login on a different account my middleware is giving me new email (Im not sure if always yet) but my page still getting old user info

On page login im using router.push

Here is my code at page (ssr)
  const cookie = cookies().get("__sessionCookie")!.value;

  const sessionVerifier = await firebaseAdmin
    .auth()
    .verifySessionCookie(cookie, true);
  const user = await firebaseAdmin.auth().getUser(sessionVerifier.uid);
  console.log("page", user.email);


that console.log is not running most of the times, and even if it does
on refreshing login page its working, but I would prefer to always run. It might be some middleware issue as I think it doesnt console.log me sometimes as well

1 Reply

SiberianOP
seems like its useRouter problem