Client Side Session Check #817
-
Hello! I’m using NextJS (latest) + Lucia (and it’s been very wonderful so far – it’s really nice to have a bit more control over the flow of things). The issue I’m running into is that when I log a user in/out, and then push them to a new page (client side), the UI doesn’t reflect the change. I’ve tried revalidating the page I used the NextJS Router example in the repo as a guide, but either I’m not understanding how to revalidate/re-render the UI, or I’m missing a key element in making sure things are up to date. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hey, sorry for the late response! I thought about this for a while but this is something I don't have an answer to, mostly due to my lack of experience using Next.js (especially the new app dir). A hard refresh might be the only solution here, unless Next.js has a way to invalidate |
Beta Was this translation helpful? Give feedback.
-
https://nextjs.org/docs/app/api-reference/functions/revalidatePath This is exactly what you are looking for. |
Beta Was this translation helpful? Give feedback.
Looks like you can reload the entire page with
router.refresh()
, which should work if you call it after logging in the user (instead of usingrouter.push()
to redirect the user to the protected page)