Next.js Discord

Discord Forum

skipping getServerSideProps remote fetches on page nav for auth user?

Unanswered
American Foxhound posted this in #help-forum
Open in Discord
American FoxhoundOP
I'm currently validating the auth session cookie and retreiving the user details via JSON api call in getServerSideProps, which passes the user down into the react app state. The user doesn't change much, so it seems wasteful to incur the extra latency to refetch this user on every page navigation event. However, if I move all auth validation/fetching to the client, it defeats on of the purposes of having SSR, which is to render a fully fleshed page instead of a loading spinner. Is it really a decision between loading spinner for obtaining auth, or, refetching a remote getServerSideProps data query on every single page nav?

0 Replies