clerk-js ignores new `ClerkProvider` options after the first load, so `afterSignOutUrl` keeps its first value
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 57/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- next.js, react, typescript
調査の方向性
Start with packages/clerk-js/src/core/clerk.ts and the __internal_updateProps and URL-builder methods; then read the options-update effect in packages/react/src/contexts/ClerkProvider.tsx. Run the linked reproduction using its listed setup steps and compare the sign-out destination before and after navigating from /en to /sk. Done means the updated provider options are respected in both the changing-provider and mounted-provider cases.
索引モデルが issue の本文から書いたものです。
説明
Preliminary Checks
-
I have reviewed the documentation: https://clerk.com/docs
-
I have searched for existing issues: https://github.com/clerk/javascript/issues
-
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
-
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://github.com/Joozty/clerk-nextjs-activity-repro
Publishable key
Not shared. The reproduction works with any development instance: put your own key in .env.local (see .env.example).
Description
clerk-js keeps the options from its first load(). If a prop of <ClerkProvider> changes later, clerk-js ignores the new value. For example, an app with two languages passes afterSignOutUrl="/en" or afterSignOutUrl="/sk". A user opens /en, clicks a link to /sk, and signs out. Clerk sends the user to /en, not to /sk.
This happens with or without cacheComponents. #5935 had the same cause for signInUrl. Its author closed it without a fix, and it is now locked.
Steps to reproduce:
- Clone the reproduction and run
pnpm install. - Copy
.env.exampleto.env.local. Set the publishable key of your own development instance there. - Run
pnpm devand open http://localhost:3000/en. - Click the
/sklink. The layout now renders<ClerkProvider afterSignOutUrl="/sk">. - Click Read Clerk.buildAfterSignOutUrl().
Expected behavior:
http://localhost:3000/sk.
Actual behavior:
http://localhost:3000/en. <UserButton> signs out to the URL from clerk.buildAfterSignOutUrl() (see packages/ui/src/contexts/components/UserButton.ts). I tested this with a real account: after I click /sk and sign out, I land on /en.
Why it happens:
- When you click
/sk, the newClerkProvidersends its options to clerk-js. Its effect calls__internal_updateProps({ options }), and the options includeafterSignOutUrl: "/sk". I checked this in the browser. Clerk.__internal_updateProps()inpackages/clerk-js/src/core/clerk.tsmerges the new options withthis.#options. But it gives the result only to Clerk's UI. It never saves it inthis.#options. Onlyload()setsthis.#options.buildAfterSignOutUrl(),buildSignInUrl(),buildSignUpUrl(),buildAfterSignInUrl()andbuildAfterSignUpUrl()readthis.#options. So they keep the first values.- There is a second, smaller problem in
@clerk/react. The effect inpackages/react/src/contexts/ClerkProvider.tsxthat calls__internal_updateProps({ options })depends only on[mergedOptions.localization]. So if oneClerkProviderstays mounted and onlyafterSignOutUrlchanges, the new value is not even sent.
#4498 added the merge in __internal_updateProps. Its changeset says "Re-init window.Clerk options when ClerkProvider props change", but the code only gives the merged options to the UI.
Possible fix:
- In
__internal_updateProps, save the merged options inthis.#options. This alone should fix the reproduction. - In
@clerk/react, send the options again when any option changes, not onlylocalization. This is for apps where oneClerkProviderstays mounted.
Workaround: custom code can call signOut({ redirectUrl }). But <UserButton> has no prop for the sign-out URL. By default, clerk-js loads from the Frontend API, not from node_modules, so a pnpm patch in the app can't fix it.
Related:
- #372 added the
@clerk/reacteffect that sends options only whenlocalizationchanges. - #3455 also merged the options of a new
ClerkProvideronly into the UI state. - #7243 removed
<UserButton afterSignOutUrl>in Core 3, so<UserButton>has no prop for the sign-out URL.
Environment
System:
OS: macOS 27.2
CPU: (10) arm64 Apple M4
Memory: 73.23 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.15.0 - /Users/jozef/.volta/tools/image/node/24.15.0/bin/node
npm: 11.12.1 - /Users/jozef/.volta/tools/image/node/24.15.0/bin/npm
pnpm: 12.4.1 - /Users/jozef/.volta/bin/pnpm
Browsers:
Chrome: 156.0.8078.48
Firefox: 159.0
Safari: 27.2
npmPackages:
@clerk/nextjs: 7.9.22 => 7.9.22
next: 16.4.3 => 16.4.3
react: 19.3.0 => 19.3.0
react-dom: 19.3.0 => 19.3.0
Loaded from the Frontend API:
@clerk/clerk-js: 6.41.0 (6.42.0 and main have the same code)
@clerk/ui: 1.42.0
- 主要言語
- TypeScript
- スター
- 1.8k
- フォーク
- 492
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 374
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
clerk/javascript のほかの issue
-
<SignIn />: the reset password code step renders an empty, focusable back button with no accessible name対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
clerk/javascript#10708 ·
メンテナーはふだん 1 日以内に返信
-
Built-in reverification dialog lacks an accessible name (aria-dialog-name)対応中かも @ItsShivam05 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
clerk/javascript#10548 ·
メンテナーはふだん 1 日以内に返信
-
MFA enrollment QR SVG lacks an accessible name (svg-img-alt)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
clerk/javascript#10547 ·
メンテナーはふだん 1 日以内に返信
-
<SignIn />: first "Use email" click switches back to phone when `initialValues.phoneNumber` is set対応中かも @twicestruck が 23 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
clerk/javascript#10487 ·
メンテナーはふだん 1 日以内に返信
-
useLoadedIsomorphicClerk misses "ready" when a ClerkProvider remounts after clerk-js has loaded — <ClerkLoading> never resolves再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
clerk/javascript#10462 ·
メンテナーはふだん 1 日以内に返信
clerk/javascript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
milind-soni/OpenMausBot#6730 ·
メンテナーはふだん 1 日以内に返信
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)オープンarea: @angular/build
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
angular/angular-cli#34764 ·
メンテナーはふだん 1 日以内に返信
-
status/need-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
google-gemini/gemini-cli#30384 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
P2
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
area:image documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信