Skip to content

fix(nextjs): key App Router ClerkProvider children - #9615

Open
therealtunguyen wants to merge 2 commits into
clerk:mainfrom
therealtunguyen:fix/nextjs-clerk-provider-key-warning
Open

fix(nextjs): key App Router ClerkProvider children#9615
therealtunguyen wants to merge 2 commits into
clerk:mainfrom
therealtunguyen:fix/nextjs-clerk-provider-key-warning

Conversation

@therealtunguyen

@therealtunguyen therealtunguyen commented Aug 29, 2026

Copy link
Copy Markdown

Description

Fixes #9415.

Adds stable keys to the static App Router ClerkProvider children so React does not emit a development-only unique-key warning when RSC streams them as lazy references. The issue's root-cause analysis describes the streaming behavior behind the warning.

Reproduction: https://github.com/ant1m4tt3r/clerk-dynamic-key-warning — the warning is logged on every page load before this change and gone after it.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring / dependency upgrade / documentation
  • other:

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@therealtunguyen is attempting to deploy a commit to the Clerk Production Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 66eaa56

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: a0fe7b62-62ae-4d8a-a08d-41fc1ba231be

📥 Commits

Reviewing files that changed from the base of the PR and between a2bd849 and 66eaa56.

📒 Files selected for processing (2)
  • packages/nextjs/src/app-router/client/__tests__/ClerkProvider.test.tsx
  • packages/nextjs/src/app-router/server/__tests__/ClerkProvider.test.tsx
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The App Router client ClerkProvider assigns explicit keys to telemetry, scripts, and children elements. The children render through a keyed React.Fragment. The server ClerkProvider assigns a key to the Suspense boundary for dynamic scripts. Tests verify these keys. A changeset declares a patch release for @clerk/nextjs.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 66eaa

This localized fix adds stable keys to App Router ClerkProvider children to prevent a development-only React warning; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #9415 by adding stable keys to the client provider children and the server scripts Suspense boundary. Tests verify the new keys, and the changeset documents the patch release…
Out of Scope Changes check ✅ Passed All changes support the linked issue: implementation updates, focused tests, and a release changeset. No unrelated code changes are present.
Title check ✅ Passed The title clearly identifies the main change: adding stable keys to App Router ClerkProvider children to fix the React warning.
Description check ✅ Passed The description directly explains the bug, root cause, reproduction, issue reference, and change type. It is related to the changeset.
Full details: Linked Issues check

Explanation

The changes address issue #9415 by adding stable keys to the client provider children and the server scripts Suspense boundary. Tests verify the new keys, and the changeset documents the patch release.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React "unique key prop" warning from ClerkProvider's own children (App Router)

1 participant