Why double auth call on server pages?
Why do server pages call auth() after calling a router but before page render if the router context already checks for auth?
1 Reply
cmiiw: are you running in debug? if yes try to do it in prod, this may have changed, but i remember that by default nextjs ran react in strict mode when in dev, one of the things this does: renders components twice to make sure they are consistent
might be wrong about this, havent been in react srsly for a while and idk how strict mode affects server components
some docs you might want to take a look at: https://react.dev/reference/react/StrictMode
i would recommend just checking if this happens when you run in prod, if not, then its prob this
<StrictMode> – React
The library for web and native user interfaces