fix(react): make ClerkProvider publishableKey optional - #9314
Conversation
🦋 Changeset detectedLatest commit: 9409e1f 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 (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~15 minutes Suggested reviewers: 🚥 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 |
Making publishableKey optional in @clerk/react's ClerkProviderProps propagated to @clerk/chrome-extension, whose provider intersects the base type without redeclaring the field. The extension has no env-var fallback and asserts the key at runtime, so omit-and-redeclare it as required (matching the other SDK wrappers) and add a type regression test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Pushed a fix directly in 7fccba0. Making
|
manovotny
left a comment
There was a problem hiding this comment.
This LGTM, but if someone on the JS/SDK team could look, that'd be great!
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