// app/layout.tsx (Server Component)
import { AuthWrapper } from "naystack/auth";
import { ApolloWrapper } from "naystack/graphql/client";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
<AuthWrapper>
<ApolloWrapper>{children}</ApolloWrapper>
</AuthWrapper>
</body>
</html>
);
}
Server Component
AuthWrapper. Same contract as the one innaystack/auth/client, but the first token fetch runs on the server with the refresh cookie forwarded and streams in through Suspense, so the client never starts logged-out-then-logged-in. Use it in a server layout; it renders the client provider underneath.