-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Fix remaining legacyBehavior deprecation warnings in Link components
🐛 Issue Description
We're getting deprecation warnings for legacyBehavior in Next.js Link components throughout the codebase. This attribute is deprecated and will be removed in a future Next.js release.
⚠️ Current Warnings
`legacyBehavior` is deprecated and will be removed in a future release. A codemod is available to upgrade your components:
npx @next/codemod@latest new-link .
Learn more: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#remove-a-tags-from-link-components
📍 Affected Files
Based on a search through the codebase, the following files still contain legacyBehavior:
src/app/(blog)/blog/(post)/[slug]/page.tsxsrc/components/sections/hero.tsxsrc/components/sections/shipping-velocity-client.tsxsrc/components/sections/main-features.tsxsrc/components/blog-author.tsxsrc/components/prismui/timeline.tsxsrc/components/blog-card.tsxsrc/components/drawer.tsxsrc/components/docs/table-of-contents.tsxsrc/components/blog/mdx.tsxsrc/components/blog/blog-card.tsxsrc/components/blog/category-card.tsxsrc/components/blog/logos.tsxsrc/components/blog/blog-layout-hero.tsxsrc/components/blog/author.tsxsrc/components/blog/table-of-contents.tsxsrc/components/blog/integrations.tsxsrc/components/blog/customers.tsxsrc/components/docs-nav.tsxsrc/components/sidebar-nav.tsxsrc/registry/section/pricing.tsxsrc/registry/example/pricing-basic.tsx
🔧 Solution
Option 1: Run the official codemod (Recommended)
npx @next/codemod@latest new-link .Option 2: Manual fixes
Remove legacyBehavior from Link components. For components with multiple children, ensure proper structure:
Before:
<Link href="/example" legacyBehavior>
<span>Title</span>
<div>Content</div>
</Link>After:
<Link href="/example">
<span>Title</span>
<div>Content</div>
</Link>✅ Acceptance Criteria
- All
legacyBehaviorattributes removed from Link components - No deprecation warnings in console
- All Link components function correctly after changes
- Registry components are updated and rebuilt (
pnpm build:registry) - No broken navigation or routing
🔍 How to Test
- Run the development server:
pnpm dev - Navigate through the site (docs, blog, components)
- Check browser console for deprecation warnings
- Verify all links work correctly
- Test registry components installation
📚 Additional Context
- Next.js introduced this deprecation to simplify Link component usage
- The new Link component can handle multiple children without
legacyBehavior - Some components may need registry rebuilding after changes
- This affects both main components and registry exports
🎯 Priority
Medium - While not breaking functionality now, this will become a breaking change in future Next.js versions.
Environment:
- Next.js: 15.4.1
- React: 18.3.1
- Node.js: 20.x
Metadata
Metadata
Assignees
Labels
No labels