fix(react): make ClerkProvider publishableKey optional - #9314
fix(react): make ClerkProvider publishableKey optional#9314SarahSoutoul wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: f12c7dd 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.
|
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
@clerk/reactCurrent version: 6.12.10 Subpath
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
clerk/javascript#7634 added the runtime fallback that allows
@clerk/reactto readVITE_CLERK_PUBLISHABLE_KEYorCLERK_PUBLISHABLE_KEYwhenpublishableKeyisn't passed to<ClerkProvider>. That PR also updated the React Vite templates to omit the explicit prop.However, the corresponding public type was not updated.
ClerkProviderPropscontinued to inherit the requiredpublishableKey: stringfield fromIsomorphicClerkOptions.As a result, applications using the environment-variable fallback work correctly at runtime, but TypeScript incorrectly reports that the
publishableKeyprop is missing.This PR makes
publishableKeyoptional specifically inClerkProviderProps, aligning the public type with the runtime behavior introduced by #7634. It also updates the type tests to cover using<ClerkProvider>without an explicit key.The focused React tests pass with no type errors, and the generated declaration exposes
publishableKey?: string.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change