Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question 💬
Hi
I use useSession in clinet. and also I use getServerSession in SSR.
but I have a small problem. when I navigate from one page to another page, if the getServerSession updates cookies, but useSession returns the previous session.
How to reproduce ☕️
1-signin
2-see useSession output log
3-change your cookie and try to invalidate your token
4-navigate from one page to another page
5-see useSession output log again
we see that the useSession output shows the previous session
I think the useSession updates only on "refetchOnWindowFocus" and "refetchInterval", but it needs to be updates if the session props of SessionProvider changed.
https://github.com/nextauthjs/next-auth/blob/main/packages/next-auth/src/react/index.tsx
it needs useEffect with [props.session] deps to update session state if props changed
Beta Was this translation helpful? Give feedback.
All reactions