Closed
Description
Environment
System:
OS: Linux 6.1 NixOS 23.11 (Tapir) 23.11 (Tapir)
CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
Memory: 8.62 GB / 15.34 GB
Container: Yes
Shell: 5.9 - /run/current-system/sw/bin/zsh
Binaries:
Node: 21.6.2 - ~/.nix-profile/bin/node
npm: 10.2.4 - ~/.nix-profile/bin/npm
pnpm: 8.15.3 - ~/.nix-profile/bin/pnpm
Browsers:
Chromium: 122.0.6261.94
npmPackages:
next: 14.1.2 => 14.1.2
next-auth: 5.0.0-beta.15 => 5.0.0-beta.15
react: ^18 => 18.2.0
Reproduction URL
https://github.com/srinesha/nextjs-testing
Describe the issue
I have setup credential provider authentication. When SessionProvider
is added in the layout, one page reload sends around 5 requests to retrieve the session even though useSession is never used anywhere in the application.
SessionProvider in layout.tsx:
https://github.com/srinesha/nextjs-testing/blob/ec5d831cd926fd86f9f0b1952df91829034ba4c3/app/settings/layout.tsx#L10C1-L14C23
2024-03-08.06-16-56ccc.mp4
How to reproduce
https://github.com/srinesha/nextjs-testing
- Clone the repository
- Install dependencies
pnpm install
- Run
pnpm dev
- Go to
localhost:3000/auth/login
- Enter any random email address
- Click on submit
- When loading the settings page, there will be many requests to get the session
Expected behavior
Send one request per page load?