You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi - basic App Router question but I'm trying to understand if calling the same Supabase operation gets automatically cached in app router similar to fetch?
I need to fetch the User on multiple pages and am calling the same function again rather than trying to pass it in Context like the good (bad) ol' useUser days.
exportasyncfunctiongetUser(){constsupabase=createClient()const{data: { user },}=awaitsupabase.auth.getUser()returnuser}
I noticed you did the same on login and pricing pages. Just want to confirm this pattern is ok and we can re-use DB read operations across pages and components without worrying about performance hits?
Thanks!
Love this starter and appreciate the app router upgrade. :)
UPDATE
I can confirm that using getUser causes the function to be called again and again at least across routes. Maybe that's ok though since you want the latest user state? Still feels very sluggish when i first click on a link and have to wait a few secondd for page to route.
The text was updated successfully, but these errors were encountered:
Hi - basic App Router question but I'm trying to understand if calling the same Supabase operation gets automatically cached in app router similar to fetch?
I need to fetch the User on multiple pages and am calling the same function again rather than trying to pass it in Context like the good (bad) ol' useUser days.
I noticed you did the same on login and pricing pages. Just want to confirm this pattern is ok and we can re-use DB read operations across pages and components without worrying about performance hits?
Thanks!
Love this starter and appreciate the app router upgrade. :)
UPDATE
I can confirm that using getUser causes the function to be called again and again at least across routes. Maybe that's ok though since you want the latest user state? Still feels very sluggish when i first click on a link and have to wait a few secondd for page to route.
The text was updated successfully, but these errors were encountered: