useSession causes hundreds/thousands of duplicate requests under slow network + async RSC

No, this is not some bad React code that is causing infinite re-renders or something. If you set nework throttle to 3G and render a client componnet in an async react server component in Next.js. And call useSession in the top layout. You can see thousands of requests to /api/auth/get-session (probably during hydration process). It even causes random hydration mismatch warnings if you display UI based on isPending of useSession under the same conditions. I've made a very thorough GitHub issue that explains this with a repo that let's you test what I'm saying. This issue is very real so please take it seriously https://github.com/better-auth/better-auth/issues/4609
GitHub
useSession causes hundreds/thousands of duplicate requests under sl...
Is this suited for github? Yes, this is suited for github To Reproduce No, this is not some bad React code that is causing infinite re-renders or something 😄 I narrowed the problem down to this rep...
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?