@clerk/react: with a preloaded Clerk instance, hooks are not loaded on the first render and <ClerkLoaded> never renders
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
- Área
- authentication, frontend
Línea de trabajo
Start by locating ClerkProvider, useAuth(), and ClerkLoaded in the React package, then trace how a preloaded Clerk instance initializes provider state and notifies subscribers. Reproduce with the listed package versions and the three steps in the issue. Done means the first render reflects the loaded instance and ClerkLoaded renders; the issue does not name a test file.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Related: #8569 (a preloaded instance passed to <ClerkProvider Clerk={clerk}> skips the UI load). We work around that by passing the UI at our own clerk.load({ ui: { ClerkUI } }). That leaves this gap.
Problem
With a preloaded instance passed as <ClerkProvider Clerk={clerk}>:
- On the first render,
useAuth()returnsisLoaded: falseanduseOrganization()has no membership, although the instance is already loaded. They become loaded one tick later, when the provider takes the instance over. <ClerkLoaded>does not re-render when that happens, so it cannot be used to wait for it.
A page that reads the role on its first render (for example, an admin-only route on a full page load) sees "not an admin" and redirects away.
Repro
@clerk/clerk-js 6.42, @clerk/react 6.18, @clerk/ui 1.42.
const clerk = new Clerk(pk); await clerk.load({ ui: { ClerkUI: ui.ClerkUI } });beforecreateRoot.- Render
<ClerkProvider Clerk={clerk}><Probe /></ClerkProvider>. - In
Probe, loguseAuth().isLoaded: the first render logsfalse. WrapProbein<ClerkLoaded>and it never renders.
Proposal
With a loaded instance, the provider starts with isLoaded: true and the session, user and organization already set. Or <ClerkLoaded> re-renders when the provider becomes loaded.
Our workaround
One wrapper at the root renders the app only when useAuth().isLoaded is true.
(issue generated with AI assistance)
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.8k
- Forks
- 492
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 357
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
-
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 Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
clerk/javascript#10548 ·
Los mantenedores suelen responder en 1 día
-
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 20 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 82/100
vercel-labs/ui#809 ·
Los mantenedores suelen responder en 1 día
-
bot:ai-assisted component:platform-js status:untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
midnightntwrk/platform-js#38 ·
-
[bug] Second false positive on high-cost plugin alert: detection only compares patch entry id, community plugin dsh-auto | [bug] 高成本插件告警第二次误报:检测只比对 patch 条目 id,社区插件 dsh-auto-review 被认成 @deepseek-ai/dsh-experimental-auto-reviewPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ranxianglei/billion-context#7068 ·
Los mantenedores suelen responder en 1 día
-
vendor: bump whisper.cpp past 6a8addd — the current pin aborts the app on a failed Metal initAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mybigday/whisper.rn#348 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
six-group/six-webcomponents#600 ·