Replies: 1 comment
-
Figured out, I have a custom signin page and of course it will trigger root layout to render first before user signin..... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
When using Next.js middleware for authentication protection, data fetching calls in the root layout are still executed even when the middleware redirects to the login page. This can lead to unnecessary API calls and potential security concerns.
Reproduction Steps
I'm wondering is that middleware won't stop server side data fetching in root layout? My thoughts was auth middleware will redirect thus root layout won't get rendered thus no fetch call should get exectued
Beta Was this translation helpful? Give feedback.
All reactions