fix(react): Respect ui prop when Clerk instance is passed to IsomorphicClerk#7997
fix(react): Respect ui prop when Clerk instance is passed to IsomorphicClerk#7997
Conversation
🦋 Changeset detectedLatest commit: 55641a5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 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.
|
|
!snapshot |
3 similar comments
|
!snapshot |
|
!snapshot |
|
!snapshot |
| @@ -474,7 +474,7 @@ export class IsomorphicClerk implements IsomorphicLoadedClerk { | |||
| this.beforeLoad(clerk); | |||
| // Only load UI scripts in standard browser environments (not native/headless) | |||
| const shouldLoadUi = !this.options.Clerk && this.options.standardBrowser !== false; | |||
There was a problem hiding this comment.
Do you think shouldLoadUi should be false if this.options.ui?.ClerkUI exists? or is that already handled elsewhere?
There was a problem hiding this comment.
Nope. I was mostly starting with a draft PR so I could get snapshots, since this issue wasn't showing up in local testing. The updated change in 2dc46ff should be a better approach, but I still need to test it.
|
!snapshot |
|
!snapshot |
|
Hey @royanger - 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.3.2-snapshot.v20260306205749 --save-exact
npm i @clerk/astro@3.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/backend@3.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/chrome-extension@3.1.0-snapshot.v20260306205749 --save-exact
npm i @clerk/clerk-js@6.0.1-snapshot.v20260306205749 --save-exact
npm i @clerk/dev-cli@0.1.1-snapshot.v20260306205749 --save-exact
npm i @clerk/expo@3.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/expo-passkeys@1.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/express@2.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/fastify@3.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/hono@0.0.4-snapshot.v20260306205749 --save-exact
npm i @clerk/localizations@4.0.1-snapshot.v20260306205749 --save-exact
npm i @clerk/msw@0.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/nextjs@7.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/nuxt@2.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/react@6.1.0-snapshot.v20260306205749 --save-exact
npm i @clerk/react-router@3.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/shared@4.0.1-snapshot.v20260306205749 --save-exact
npm i @clerk/tanstack-react-start@1.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/testing@2.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/ui@1.1.0-snapshot.v20260306205749 --save-exact
npm i @clerk/upgrade@2.0.2-snapshot.v20260306205749 --save-exact
npm i @clerk/vue@2.0.2-snapshot.v20260306205749 --save-exact |
|
!snapshot |
|
Hey @royanger - 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.3.2-snapshot.v20260306224304 --save-exact
npm i @clerk/astro@3.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/backend@3.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/chrome-extension@3.1.0-snapshot.v20260306224304 --save-exact
npm i @clerk/clerk-js@6.1.0-snapshot.v20260306224304 --save-exact
npm i @clerk/dev-cli@0.1.1-snapshot.v20260306224304 --save-exact
npm i @clerk/expo@3.1.0-snapshot.v20260306224304 --save-exact
npm i @clerk/expo-passkeys@1.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/express@2.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/fastify@3.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/hono@0.0.4-snapshot.v20260306224304 --save-exact
npm i @clerk/localizations@4.1.0-snapshot.v20260306224304 --save-exact
npm i @clerk/msw@0.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/nextjs@7.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/nuxt@2.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/react@6.1.0-snapshot.v20260306224304 --save-exact
npm i @clerk/react-router@3.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/shared@4.1.0-snapshot.v20260306224304 --save-exact
npm i @clerk/tanstack-react-start@1.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/testing@2.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/ui@1.1.0-snapshot.v20260306224304 --save-exact
npm i @clerk/upgrade@2.0.2-snapshot.v20260306224304 --save-exact
npm i @clerk/vue@2.0.2-snapshot.v20260306224304 --save-exact |
Description
The guard that causes the bug is:
@clerk/react, @clerk/nextjs, etc.: this.options.Clerk is undefined → !this.options.Clerk is true → shouldLoadUi is true → getClerkUIEntryChunk() runs → finds uiProp.ClerkUI from the ui prop and returns it → ClerkUI is valid, no overwrite.
@clerk/chrome-extension: this.options.Clerk is a Clerk instance (truthy) → !this.options.Clerk is false → shouldLoadUi is false → ClerkUI = undefined → overwrites the valid ClerkUI from the ui prop.
The chrome-extension needs its own Clerk instance because it has to wire up extension-specific hooks (JWT handling, cookie syncing, storage cache, etc.) in createClerkClient before the instance is used.
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change