ClerkProvider mounts the `@clerk/ui` component renderer on every page load (~234 KB extra JS without any auth intent)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 45/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- next.js, node.js, react, typescript
- Domínio
- authentication, frontend, performance
Direção de pesquisa
Start by tracing the provider effects in @clerk/react and how __internal_updateProps and ensureMounted() interact in @clerk/clerk-js; the issue cites their published package files and the related fixes #4498, #4876, and #7901. Reproduce with a Next.js App Router page that has no Clerk components, then inspect the network chunks. Done means the renderer and billing chunks do not load on an idle page while mount*() and open*() still work as expected.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
With a plain <ClerkProvider> (Next.js App Router, UI loaded from the Clerk CDN, no ui prop), every page load
downloads and evaluates the full @clerk/ui renderer after v1/client, even if the page renders no Clerk component
and no modal is ever opened. We expected the renderer to mount on the first open*() / mount*() call.
Measured on a production app (signed out, no Clerk component on the page, transfer sizes):
| Chunk | Transfer |
|---|---|
framework_ui_*_1.25.0.js |
43 KB |
ui-common_ui_*_1.25.0.js |
122 KB |
vendors_ui_*_1.25.0.js |
64 KB |
subscriptionDetails_ui_*_1.25.0.js |
5 KB |
That is ~234 KB on the wire, ~765 KB of raw JS to parse and evaluate on every page view, plus ui.browser.js itself.
subscriptionDetails is loaded although Clerk Billing is not used. With the bundled ui prop the same chunks load,
from the app bundle instead.
Versions
@clerk/nextjs7.5.14,@clerk/react6.12.0,@clerk/shared4.25.0@clerk/clerk-js6.41.0 (CDN,@6),@clerk/ui1.25.0 (CDN, version pinned)- Next.js 16.4.3, React 19.3.0
- Same code paths in the latest versions as of 2026-11-05:
@clerk/react6.18.6,@clerk/clerk-js6.42.3,@clerk/ui1.42.4
Cause (code references in the published packages)
@clerk/react6.12.0,dist/ClerkProvider-GF8qvIpk.mjs:1544–1549:useLoadedIsomorphicClerkhas two effects that
callisomorphicClerk.__internal_updateProps(...), one forappearanceand one forlocalization. They run on the
first mount, even if the values equal the options already passed toclerk.load().@clerk/clerk-js6.41.0 (dist/clerk.browser.js):__internal_updatePropsalways mounts first:
return this.#eR?.then(e=>e.ensureMounted()).then(e=>e.updateProps(t)). This dates from #4498.@clerk/ui1.25.0,dist/Components.js:34–42: the firstensureMounted()importslazyModules/common.js
(framework, ui-common, vendors) and rendersComponents.@clerk/ui1.25.0,dist/Components.js:431–444anddist/lazyModules/drawers.js:Componentsalways renders
MountedCheckoutDrawer,MountedPlanDetailDrawerandMountedSubscriptionDetailDrawer. They areReact.lazy
modules, so rendering them while closed loads the billing chunk.
Expected
__internal_updatePropscalled before the renderer is mounted should store the props and apply them on mount,
instead of callingensureMounted(). A similar early mount was fixed for the keyless prompt in #4876. #7901 already
preloads component chunks onmount*()/open*(), so the first modal would not wait long.- The billing drawers should render only when opened, or only when Billing is enabled for the instance.
Steps to reproduce
- Create a Next.js App Router app and wrap the root layout in
<ClerkProvider>(CDN UI, nouiprop). Pass
localizationorappearance, or none: the effects run on mount either way. - Render a page without any Clerk component and do not interact with it.
- In the Network panel, after
v1/client, theframework_ui_*,ui-common_ui_*,vendors_ui_*and
subscriptionDetails_ui_*chunks load.
Related question: shared React variant
@clerk/react sets clerkUIVariant: "shared" for compatible React versions (ClerkProvider-GF8qvIpk.mjs:1536–1539),
and @clerk/ui ships dist/ui.shared.browser.js without its own React. The CDN loader in @clerk/shared 4.25.0
always requests dist/ui.browser.js (dist/loadClerkJsScript.js:141–149). We found no consumer of clerkUIVariant
in clerk.browser.js 6.41.0 or in ui.browser.js 1.25.0. As a result the CDN path always loads the variant with its
own React (framework_ui, ~43 KB). Is there a supported way to load the shared variant from the CDN, or is this
expected?
Thanks!
- Linguagem predominante
- TypeScript
- Estrelas
- 1.8k
- Forks
- 492
- Merge médio
- 1d 8h
- PRs com merge (30d)
- 374
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de clerk/javascript
-
<SignIn />: the reset password code step renders an empty, focusable back button with no accessible nameTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
clerk/javascript#10708 ·
Mantenedores costumam responder em até 1 dia
-
Built-in reverification dialog lacks an accessible name (aria-dialog-name)Talvez já em andamento @ItsShivam05 assumiu há 5 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
clerk/javascript#10548 ·
Mantenedores costumam responder em até 1 dia
-
MFA enrollment QR SVG lacks an accessible name (svg-img-alt)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
clerk/javascript#10547 ·
Mantenedores costumam responder em até 1 dia
-
<SignIn />: first "Use email" click switches back to phone when `initialValues.phoneNumber` is setTalvez já em andamento @twicestruck assumiu há 23 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
clerk/javascript#10487 ·
Mantenedores costumam responder em até 1 dia
-
useLoadedIsomorphicClerk misses "ready" when a ClerkProvider remounts after clerk-js has loaded — <ClerkLoading> never resolvesTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
clerk/javascript#10462 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de clerk/javascript
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
milind-soni/OpenMausBot#6730 ·
Mantenedores costumam responder em até 1 dia
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Abertaarea: @angular/build
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
angular/angular-cli#34764 ·
Mantenedores costumam responder em até 1 dia
-
status/need-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
google-gemini/gemini-cli#30384 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
P2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia
-
area:image documentation good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia