@clerk/nextjs ≥ 7.9.24: module-level displayName mutation breaks App Router PPR resume ("Expected the resume to render <ClerkProvider> … <ReactClerkProvider>")
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 64/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- next.js, react, typescript
- Bereich
- backend-api-design
Rechercherichtung
Start with dist/esm/pages/ClerkProvider.js and trace how components.client.js and client-boundary/ClerkProvider.js load it alongside the App Router provider. Compare the 7.9.23 and 7.9.24 behavior around ReactClerkProvider.displayName, then run the linked reproduction’s build and request the page twice. Done means both requests resume the prerendered shell without the component-name mismatch or client-render fallback.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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/marcvive/clerk-ppr-resume-repro
Publishable key
pk_test_ZGVsaWNhdGUtYmx1ZWpheS05NDQwLmNsZXJrLmFjY291bnRzLmRldiQ
Description
Since 7.9.24, App Router apps using Partial Prerendering (cacheComponents: true) fail to resume their prerendered shell once a client component importing Show from @clerk/nextjs has been loaded on the server. The route falls back to client rendering on every request after that.
Steps to reproduce:
- Clone the reproduction,
cp .env.local.example .env.localand add the keys of a development instance. npm install && npm run build && npm start- Request the page twice:
curl -s http://localhost:3200/ > /dev/null(twice).
Expected behavior:
Both requests resume the prerendered shell without errors — as they do on @clerk/nextjs 7.9.23 (same repro, npm install @clerk/[email protected] --save-exact, rebuild).
Actual behavior:
The first request is fine. Every later request logs on the server:
Error: Expected the resume to render <ClerkProvider> in this slot but instead it rendered <ReactClerkProvider>. The tree doesn't match so React will fallback to client rendering.
and the browser logs minified React error #419. In our real app this fails our Playwright E2E suite; pinning 7.9.23 fixes it.
Root cause:
In 7.9.24, dist/esm/pages/ClerkProvider.js moved ReactClerkProvider.displayName = "ReactClerkProvider"; from inside the Pages Router ClerkProvider render function to module top level. ReactClerkProvider is InternalClerkProvider from @clerk/react/internal — the same component object the App Router provider (app-router/client/ClerkProvider.js) renders, and which @clerk/react names "ClerkProvider".
components.client.js → client-boundary/ClerkProvider.js imports ../pages/ClerkProvider unconditionally, and Show / ClerkProvider are re-exported from #components (= components.client.js). So the provider's name depends on load order: the build-time prerender records <ClerkProvider> in the postponed state; once a client component using Show is loaded on the server, every resume sees <ReactClerkProvider>. React's resume check compares component names (displayName || name), so it throws.
Hooks such as useAuth alone don't trigger it, because the package is "sideEffects": false and they never load components.client.js.
Suggested fix:
Don't mutate the shared component's displayName: move the assignment back inside the Pages Router render, or wrap the provider in a separately named local component.
Workaround: pin @clerk/[email protected].
Environment
System:
OS: Windows 11 10.0.26200
CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
Memory: 10.15 GB / 31.57 GB
Binaries:
Node: 24.22.1 - C:\Program Files\nodejs\node.EXE
npm: 11.19.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 156.0.8078.80
Edge: Chromium (152.0.4191.53)
Firefox: 159.0.1 - C:\Program Files\Mozilla Firefox\firefox.exe
npmPackages:
@clerk/nextjs: 7.9.25 => 7.9.25
next: 16.4.5 => 16.4.5
react: 19.3.1 => 19.3.1
react-dom: 19.3.1 => 19.3.1
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1.8k
- Forks
- 492
- Ø Merge
- 1 T. 7 Std.
- Gemergte PRs (30 T.)
- 357
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus clerk/javascript
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
clerk/javascript#10708 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Built-in reverification dialog lacks an accessible name (aria-dialog-name)Evtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
clerk/javascript#10548 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
clerk/javascript#10547 ·
Maintainer antworten meist innerhalb von 1 Tag
-
<SignIn />: first "Use email" click switches back to phone when `initialValues.phoneNumber` is setEvtl. vergeben @twicestruck hat das vor 20 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
clerk/javascript#10487 ·
Maintainer antworten meist innerhalb von 1 Tag
-
useLoadedIsomorphicClerk misses "ready" when a ClerkProvider remounts after clerk-js has loaded — <ClerkLoading> never resolvesEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
clerk/javascript#10462 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in clerk/javascript
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
ilan-pinto/roaring-lions#1552 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug: [React Native/Android] KeepAliveService never starts when CAMERA is not granted (Android 14+)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
cloudflare/realtimekit-ui#208 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
usebruno/bruno-vscode#235 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag