This demo shows how Server Components that take a long time to render (2-3 seconds) create loading states but are isolated by Suspense boundaries. Notice how each RSC loads independently.
This Server Component uses auth() to check authentication status. Notice how it renders in its own Suspense boundary with a loading state.
Server component rendering (2s delay)...
This Server Component uses currentUser() to fetch complete user data. Compare its timing and data with the client-side version below.
Server component rendering (3s delay)...
This client component uses useUser() to fetch the same user data. Compare: it shows identical data but hydrates almost instantly, independent of the slow RSCs above.
Hydrated in 0ms
No user data available
This fetched the same data client-side and hydrated almost instantly, independent of the slow server component above!
auth() and currentUser() can be used in async RSCsuseUser() fetch the same data client-side and hydrate independently without waiting for slow RSCsTook 2014ms to render on server
Auth Status: Not authenticated
This RSC took 2000ms to complete. Notice how client components below hydrated independently!
Server fetch took 3003ms
No user data available
Even though this took 3000ms, client components using useAuth() and useSession() became interactive immediately!