-
Notifications
You must be signed in to change notification settings - Fork 408
feat(react): Remove initialAuthState option from useAuth
#7194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: vincent-and-the-doctor
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 19b996b The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
initialAuthState option from useAuthinitialAuthState option from useAuth
…uth instead of at the ClerkProvider level
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Description
Note
Keeping this with the
do not mergelabel until I've done some more testing and verifying.This PR refactors the React
ClerkProviderby introducing a newInitialAuthStateProvider, and moves resolving the correctinitialState | statedown into theuseAuthhook. This is a first step towards moving more logic down into the hooks.This PR also refactors the
ClerkProviderin@clerk/nextjsto not rely onPromisifiedAuthContextand removes theusePromisifiedAuth. When nesting two providers like this:The inner provider does not render the React
ClerkProvider. For this specific case, thePromisifiedAuthContextwas fulfilling a role as a separate initial state context. This PR instead uses the newInitialAuthStateProviderdirectly for this use case.The
usePromisifiedAuthhook was the only placeuseAuth(initialAuthState)was being used, an option specifically option, we now rely on the internal<InitialAuthStateProvider>instead.This is technically a breaking change, but I expect few if any users to be relying on this option, the encouraged way to populate auth state ahead of Clerk loading on the client is to do it at the
<ClerkProvider>level.We are planning improvements around how hydration of the auth state works, and keeping the API surface small and implementation complexity low will help with that.
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change