Next.js Discord

Discord Forum

Client side code in server components?

Unanswered
Crucian carp posted this in #help-forum
Open in Discord
Original message was deleted.

1 Reply

Well In your server page, you are checking if the user is authenticated or not , right?

So If you are using app router,

add a loading.tsx so this component will show up until your server functions are done.

If you just return the function when you check if there is any user or not, the page will be displayed to user, other wise you will continue to fetch data, so it will still show the loading.tsx page.

Did i understand your case ?