Skip to content

Conversation

@danielr18
Copy link
Contributor

Fixes #295

AuthKitProvider was always fetching auth data on mount. Added an optional initialAuth prop so you can pass the data directly from your server component and skip the unnecessary round trip.

Example:

export default async function RootLayout({ children }) {
  const auth = await withAuth();
  const { accessToken, ...initialAuth } = auth;

  return (
    <AuthKitProvider initialAuth={initialAuth}>{children}</AuthKitProvider>
  );
}

Not sure if this is the best approach, but there should be a way to avoid the server action call on every initial mount if preferred.

@danielr18 danielr18 requested a review from a team as a code owner October 19, 2025 18:24
@danielr18 danielr18 requested a review from stanleyphu October 19, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

AuthKitProvider - redundant api call

1 participant