useSession seems to cause the component to re-mount when page leaves focus
Answered
Lionhead posted this in #help-forum
LionheadOP
Whenever I leave tab or minimize browser, it is re-mounting the component with a new session.
I do not have other session state changers apart from defining it as:
See component code and nextauth here:
https://pastebin.com/D4hGUZNX
Would anyone be able to tell why does it change sessions whenever page defocuses? Kinda makes no sense to me
I do not have other session state changers apart from defining it as:
const { data: session, status } = useSession();
See component code and nextauth here:
https://pastebin.com/D4hGUZNX
Would anyone be able to tell why does it change sessions whenever page defocuses? Kinda makes no sense to me

Answered by Spectacled bear
You can pass false to
Docs: https://next-auth.js.org/getting-started/client#options
refetchOnWindowFocus
in <SessionProvider>
optionsDocs: https://next-auth.js.org/getting-started/client#options
3 Replies
Spectacled bear
You can pass false to
Docs: https://next-auth.js.org/getting-started/client#options
refetchOnWindowFocus
in <SessionProvider>
optionsDocs: https://next-auth.js.org/getting-started/client#options
Answer
LionheadOP
Thank you 🙏
Spectacled bear
If your issue is fixed, please mark it resolved.