Replies: 2 comments 1 reply
-
I wonder the same thing. It seems very inefficient to use getUser() once in the middleware and once inside the server component just to retrieve the user information. I opted in for using getSession() inside the server components but as of the last update i get a warning
which is pretty annoying |
Beta Was this translation helpful? Give feedback.
-
Did you find a solution for this ? I call getUser() in the root layout and make a UserProvider component so you will have acces to it everywhere, this is how i fixed it. The real problem is that updateSession is getting triggered in the middleware everytime and this sends request to auth/v1/request. Shouldnt we block this updateSession ? we check the session before we trigger updateSession and if the session is going to expire we updateSession. |
Beta Was this translation helpful? Give feedback.
-
https://supabase.com/docs/guides/auth/server-side/nextjs
The middleware is calling getUser() to check if someone is logged in and if not redirects them. But I'm very confused, because later in the PrivatePage example it calls getUser() again.
This seems super inefficient - why do we even need the middleware if we are having to getUser()? Is there a way to just pass the getUser object down to the page so we don't have to duplicate?
This is adding latency for every single page the app - feels there should be a proper way to do this?
Beta Was this translation helpful? Give feedback.
All reactions