-
Notifications
You must be signed in to change notification settings - Fork 424
feat(upgrade): Add codemod to move ClerkProvider inside body #7596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add jscodeshift codemod that transforms ClerkProvider from wrapping <html> to being inside <body> for Next.js 16 cache components support. This codemod handles: - Moving ClerkProvider inside body element - Preserving all ClerkProvider props - Handling layouts with multiple body children - Handling layouts with head elements
🦋 Changeset detectedLatest commit: de2f6f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
- Add transform-clerk-provider-inside-body to core-3 codemods list - Add change document explaining the ClerkProvider positioning for Next.js 16 cache components support
📝 WalkthroughWalkthroughAdds a new codemod 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Codemods can now specify which SDKs they apply to using the packages
property. This matches the existing pattern used for change documents.
Example:
codemods: [
'transform-all', // runs for all SDKs
{ name: 'transform-nextjs-only', packages: ['nextjs'] },
]
The ClerkProvider codemod now only runs for nextjs upgrades.
|
🥇 |
…ider codemod
- Support aliased imports like `import { ClerkProvider as CP }`
- Handle multiple ClerkProviders by only transforming those wrapping <html>
- Simplify whitespace handling (rely on user's formatter)
- Add test fixtures for new edge cases
Summary
ClerkProviderfrom wrapping<html>to being inside<body>cacheComponentsis enabled,ClerkProvidermust be positioned inside<body>to avoid "Uncached data was accessed outside of<Suspense>" errorsWhat it does
Transforms layouts from:
To:
Test plan
npx @clerk/upgradeon a sample Next.js projectRelated
Summary by CodeRabbit
New Features
Tests
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.