naystack - v1.9.9
    Preparing search index...

    Function AuthWrapper

    • Server Component AuthWrapper. Same contract as the one in naystack/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.

      Parameters

      Returns Element

      // 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>
      );
      }