-
Notifications
You must be signed in to change notification settings - Fork 431
fix(clerk-js): Support both clerkUICtor and clerkUiCtor for backwards compatibility #7712
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: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: f4ea9e3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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.
|
📝 WalkthroughWalkthroughThis pull request adds backwards compatibility support to the 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@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/ui
@clerk/upgrade
@clerk/vue
commit: |
|
!snapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/clerk-js/src/core/clerk.ts`:
- Around line 3250-3259: Add unit tests to cover the backward-compatible alias
behavior introduced in the `#initOptions` function: write tests that instantiate
Clerk (or call Clerk.prototype.#initOptions via a public initialization helper)
passing options with clerkUICtor and separately with the legacy clerkUiCtor and
assert that the resulting configuration uses the same constructor value in
clerkUICtor; include tests for both merging with defaultOptions and for when
only the legacy key is provided to ensure createAllowedRedirectOrigins and other
returned properties are preserved. Ensure tests reference the public
initialization path that exercises `#initOptions` (e.g., new Clerk(...) or init
method) and assert equality of the effective clerkUICtor and other merged
fields.
| #initOptions = (options?: ClerkOptions): ClerkOptions => { | ||
| // Support both clerkUICtor (correct) and clerkUiCtor (legacy) for backwards compatibility | ||
| const clerkUICtor = | ||
| options?.clerkUICtor ?? (options as Record<string, unknown> | undefined)?.clerkUiCtor ?? undefined; | ||
|
|
||
| return { | ||
| ...defaultOptions, | ||
| ...options, | ||
| clerkUICtor: clerkUICtor as ClerkOptions['clerkUICtor'], | ||
| allowedRedirectOrigins: createAllowedRedirectOrigins( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for the legacy alias behavior before merge.
This PR changes initialization to accept both clerkUICtor and clerkUiCtor, but no tests were added to lock in that behavior. Please add coverage for both option names.
As per coding guidelines, “If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.”
🤖 Prompt for AI Agents
In `@packages/clerk-js/src/core/clerk.ts` around lines 3250 - 3259, Add unit tests
to cover the backward-compatible alias behavior introduced in the `#initOptions`
function: write tests that instantiate Clerk (or call
Clerk.prototype.#initOptions via a public initialization helper) passing options
with clerkUICtor and separately with the legacy clerkUiCtor and assert that the
resulting configuration uses the same constructor value in clerkUICtor; include
tests for both merging with defaultOptions and for when only the legacy key is
provided to ensure createAllowedRedirectOrigins and other returned properties
are preserved. Ensure tests reference the public initialization path that
exercises `#initOptions` (e.g., new Clerk(...) or init method) and assert equality
of the effective clerkUICtor and other merged fields.
|
Hey @jacekradko - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.2.9-snapshot.v20260130121458 --save-exact
npm i @clerk/astro@3.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/backend@3.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/chrome-extension@3.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/clerk-js@6.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/dev-cli@1.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/expo@3.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/expo-passkeys@1.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/express@2.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/fastify@2.7.0-snapshot.v20260130121458 --save-exact
npm i @clerk/localizations@4.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/msw@0.0.1-snapshot.v20260130121458 --save-exact
npm i @clerk/nextjs@7.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/nuxt@2.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/react@6.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/react-router@3.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/shared@4.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/tanstack-react-start@1.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/testing@2.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/ui@1.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/upgrade@2.0.0-snapshot.v20260130121458 --save-exact
npm i @clerk/vue@2.0.0-snapshot.v20260130121458 --save-exact |
Summary
clerkUiCtoroption (lowercase "i") in clerk-jsclerkUICtor(uppercase "UI"), but some SDKs may still be passing the lowercase version#initOptionsso both casing variants workTest plan
clerkUICtorclerkUiCtorSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.