ClerkProvider mounts the `@clerk/ui` component renderer on every page load (~234 KB extra JS without any auth intent)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- next.js, node.js, react, typescript
- Área
- authentication, frontend, performance
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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!
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.8k
- Forks
- 492
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 374
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de clerk/javascript
-
<SignIn />: the reset password code step renders an empty, focusable back button with no accessible namePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
clerk/javascript#10708 ·
Los mantenedores suelen responder en 1 día
-
Built-in reverification dialog lacks an accessible name (aria-dialog-name)Posiblemente ocupada @ItsShivam05 la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
clerk/javascript#10548 ·
Los mantenedores suelen responder en 1 día
-
MFA enrollment QR SVG lacks an accessible name (svg-img-alt)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
clerk/javascript#10547 ·
Los mantenedores suelen responder en 1 día
-
<SignIn />: first "Use email" click switches back to phone when `initialValues.phoneNumber` is setPosiblemente ocupada @twicestruck la tomó hace 23 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
clerk/javascript#10487 ·
Los mantenedores suelen responder en 1 día
-
useLoadedIsomorphicClerk misses "ready" when a ClerkProvider remounts after clerk-js has loaded — <ClerkLoading> never resolvesQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
clerk/javascript#10462 ·
Los mantenedores suelen responder en 1 día
Todos los issues de clerk/javascript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
milind-soni/OpenMausBot#6730 ·
Los mantenedores suelen responder en 1 día
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Abiertoarea: @angular/build
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
angular/angular-cli#34764 ·
Los mantenedores suelen responder en 1 día
-
status/need-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
google-gemini/gemini-cli#30384 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
P2
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
area:image documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día