79320100

Date: 2024-12-31 13:50:34
Score: 0.5
Natty:
Report link

Are you using next-auth in your project? if yes then the might be in next-auth and not nextjs. By default next-auth refreshes session each time the window or tab gets focussed. to disable this behavior of next-auth, find SessionProvider in your project and set the "refetchOnWindowFocus" attribute to true like this:

<SessionProvider refetchOnWindowFocus={false}>

This solved the issue for me. There are other useful attributes for SessionProvider as well through which you can even better control session refresh.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Kamran Shahid