loadClerkJsScript broken clerk/react
@jacekradko がすでに取り組んでいます。
2026年5月19日 から。
評価
この 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
Publishable key
pk_test_bWVycnktamF3ZmlzaC00LmNsZXJrLmFjY291bnRzLmRldiQ
Description
This situation:
- Latest React Router SPA
clientLoaderthat wants to use clerk authentication to hit a API endpoint- React page which uses clerk UI components
Causes Clerk was not loaded with Ui components to be thrown.
This occurs because:
clientLoadercallsgetClient()getClientloads clerk JS ifwindow.Clerkis not available- something changed recently where
loadClerkJsScript,clerk.load(), or the JS that is dynamically loaded causes the UI stuff to not get loaded.
Here's the getClient implementation:
export async function getClient() {
const windowWithClerk = window as Window & { Clerk?: LoadedClerk }
if (!windowWithClerk.Clerk) {
// recommended officially here:
// https://clerk.com/docs/references/sdk/frontend-only#call-window-clerk-load
await loadClerkJsScript({
publishableKey: CLERK_PUBLIC_KEY,
})
}
invariant(windowWithClerk.Clerk, "Clerk should be defined")
const clerk = windowWithClerk.Clerk
if (!clerk.loaded) {
await clerk.load()
}
// protect users from hitting the internal API if they aren't authenticated
if (!clerk.user) {
await clerk.redirectToSignIn()
return
}
return clerk
}
I think a recent change in the dynamically loaded clerk javascript has caused UI components to not be loaded when you load the clerk javascript outside of the React provider. I believe the culprit is the dynamically loaded clerk code because dropping package versions did not fix the issue and I've have tests from ~2w ago where this worked just fine.
Attempted discord but got no useful response.
Steps to reproduce:
this file and the surrounding repository replicates the failure.
Expected behavior:
UI components loaded & the ability for me to access a clerk client (a) without calling the clerk endpoints twice and using clerk-js (b) before the react render cycle has run (i.e. within clientLoader).
Actual behavior:
The following exception is thrown when a page is loaded that contains Clerk React UI components.
Error: Clerk was not loaded with Ui components
at nG.assertComponentsReady (https://notable-rhino-51.clerk.accounts.dev/npm/@clerk/clerk-js@6/dist/clerk.browser.js:18:214256)
at nG.mountUserButton (https://notable-rhino-51.clerk.accounts.dev/npm/@clerk/clerk-js@6/dist/clerk.browser.js:18:180854)
at Object.mountUserButton [as mount] (https://python-starter-template.localhost/node_modules/.vite/deps/@clerk_react.js?v=a49ee953:6045:50)
at ClerkHostRenderer.componentDidMount (https://python-starter-template.localhost/node_modules/.vite/deps/@clerk_react.js?v=a49ee953:3897:45)
at Object.react_stack_bottom_frame (https://python-starter-template.localhost/node_modules/.vite/deps/client-CS_gmzuS.js?v=a49ee953:12882:14)
at runWithFiberInDEV (https://python-starter-template.localhost/node_modules/.vite/deps/client-CS_gmzuS.js?v=a49ee953:851:66)
at reappearLayoutEffects (https://python-starter-template.localhost/node_modules/.vite/deps/client-CS_gmzuS.js?v=a49ee953:7532:57)
at recursivelyTraverseReappearLayoutEffects (https://python-starter-template.localhost/node_modules/.vite/deps/client-CS_gmzuS.js?v=a49ee953:7588:65)
at reappearLayoutEffects (https://python-starter-template.localhost/node_modules/.vite/deps/client-CS_gmzuS.js?v=a49ee953:7578:14)
at recursivelyTraverseReappearLayoutEffects (https://python-starter-template.localhost/node_modules/.vite/deps/client-CS_gmzuS.js?v=a49ee953:7588:65)
Environment
System:
OS: macOS 26.4.1
CPU: (12) arm64 Apple M2 Max
Memory: 186.81 MB / 96.00 GB
Shell: 5.9 - /opt/homebrew/bin/zsh
Binaries:
Node: 24.15.0 - /Users/mike/.local/share/mise/installs/node/24.15.0/bin/node
npm: 11.12.1 - /Users/mike/.local/share/mise/installs/node/24.15.0/bin/npm
pnpm: 11.1.2 - /Users/mike/.local/share/mise/installs/pnpm/11.1.2/pnpm
bun: 1.3.14 - /Users/mike/.local/share/mise/installs/bun/1.3.14/bin/bun
Deno: 2.7.11 - /opt/homebrew/bin/deno
Browsers:
Chrome: 148.0.7778.168
Chrome Canary: 150.0.7835.0
Firefox: 139.0.1
Safari: 26.4
Safari Technology Preview: 26.0
- 主要言語
- TypeScript
- スター
- 1.8k
- フォーク
- 472
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 222
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
clerk/javascript のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
clerk/javascript#9611 · コメント 1 件 ·
-
clerk/javascript#9891 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 64/100
clerk/javascript#9775 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
clerk/javascript#9770 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
clerk/javascript#9667 · コメント 1 件 ·
clerk/javascript の issue をすべて見る
似ている issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Crush オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ElementsProject/cln-application#167 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Quantco/pnpm-licenses#17 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100