Skip to content

Conversation

@SHUBHANSHU602
Copy link

@SHUBHANSHU602 SHUBHANSHU602 commented Jan 3, 2026

What does this PR do?

This PR removes the deprecated legacyBehavior usage from the custom Link component and aligns it with the modern Next.js Link API.

The change ensures forward compatibility with upcoming Next.js versions where legacyBehavior is removed.


Why is this change needed?

  • legacyBehavior is deprecated in Next.js and scheduled for removal
  • Keeping it causes warnings and future breakage
  • The current implementation does not rely on legacy anchor wrapping, so removal is safe

Scope of this PR

✅ Only updates the custom Link component
❌ No formatting, config, localization, or unrelated changes
❌ No dependency or lockfile changes


Testing

  • Verified build and lint locally
  • Navigation behavior remains unchanged
  • External and internal links continue to work as expected

Notes

This PR is intentionally minimal and scoped only to removing deprecated API usage.
Issue Number:-#4748

Summary by CodeRabbit

  • Refactor
    • Simplified the Link component by removing deprecated legacy behavior and related options, clarifying its API and reducing complexity for future use.

✏️ Tip: You can customize this high-level summary in your review settings.

@netlify
Copy link

netlify bot commented Jan 3, 2026

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7be940c
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/695993abde96a7000874734b
😎 Deploy Preview https://deploy-preview-4871--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 3, 2026

📝 Walkthrough

Walkthrough

The PR removes the legacyBehavior prop from the custom Link component implementation in components/link.tsx, deleting it from LinkComponentProps, LinkComponent, and LinkText signatures and removing all forwarding/usages of legacyBehavior within the file.

Changes

Cohort / File(s) Summary
Link component prop removal
components/link.tsx
Removed legacyBehavior?: boolean from LinkComponentProps; removed legacyBehavior parameter from LinkComponent and LinkText; eliminated forwarding/usage of legacyBehavior (and removed passHref usages in those call sites); updated JSDoc/comments and minor formatting.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰
I hopped through lines both old and new,
Snipped a prop and set it loose,
Code feels lighter, skies are blue,
Tiny trim — a joyful cruise,
Sniff, twitch, and onward I pursue 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removal of the deprecated legacyBehavior prop from the Link component, which is the sole focus of the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Jan 3, 2026

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 38
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-4871--asyncapi-website.netlify.app/

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/link.tsx (1)

22-28: Fix Prettier formatting to pass CI.

The pipeline reports that Prettier expects the function parameters on a single line. Please run npm run format or prettier --write components/link.tsx to resolve this formatting issue.

Expected format
-export default function LinkComponent({
-  children,
-  locale,
-  target = '_self',
-  rel = '',
-  ...props
-}: LinkComponentProps) {
+export default function LinkComponent({ children, locale, target = '_self', rel = '', ...props }: LinkComponentProps) {
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 18ec38f and f37e4d0.

📒 Files selected for processing (1)
  • components/link.tsx
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: akshatnema
Repo: asyncapi/website PR: 3262
File: components/navigation/BlogPostItem.tsx:80-87
Timestamp: 2024-10-11T11:17:32.246Z
Learning: In the `BlogPostItem` component, the parent `Link` wraps the entire content, so inner `Link` components around the title and excerpt are unnecessary.
Learnt from: akshatnema
Repo: asyncapi/website PR: 3262
File: components/navigation/BlogPostItem.tsx:95-119
Timestamp: 2024-10-11T11:32:30.226Z
Learning: In the `BlogPostItem` component (`components/navigation/BlogPostItem.tsx`), nesting `<a>` tags inside the parent `Link` component leads to hydration issues; therefore, we should avoid nesting `<a>` tags inside `Link` components in this component.
📚 Learning: 2024-10-11T11:32:30.226Z
Learnt from: akshatnema
Repo: asyncapi/website PR: 3262
File: components/navigation/BlogPostItem.tsx:95-119
Timestamp: 2024-10-11T11:32:30.226Z
Learning: In the `BlogPostItem` component (`components/navigation/BlogPostItem.tsx`), nesting `<a>` tags inside the parent `Link` component leads to hydration issues; therefore, we should avoid nesting `<a>` tags inside `Link` components in this component.

Applied to files:

  • components/link.tsx
📚 Learning: 2024-10-11T11:17:32.246Z
Learnt from: akshatnema
Repo: asyncapi/website PR: 3262
File: components/navigation/BlogPostItem.tsx:80-87
Timestamp: 2024-10-11T11:17:32.246Z
Learning: In the `BlogPostItem` component, the parent `Link` wraps the entire content, so inner `Link` components around the title and excerpt are unnecessary.

Applied to files:

  • components/link.tsx
📚 Learning: 2024-10-11T10:46:58.882Z
Learnt from: akshatnema
Repo: asyncapi/website PR: 3262
File: components/Avatar.tsx:35-44
Timestamp: 2024-10-11T10:46:58.882Z
Learning: In Next.js, when avoiding nested `<a>` tags due to hydration issues, use accessible non-link elements like `<button>` or `<span>` with appropriate roles, `tabIndex`, and event handlers to maintain accessibility and SEO.

Applied to files:

  • components/link.tsx
📚 Learning: 2024-10-11T07:38:35.745Z
Learnt from: akshatnema
Repo: asyncapi/website PR: 3262
File: components/newsroom/FeaturedBlogPost.tsx:90-92
Timestamp: 2024-10-11T07:38:35.745Z
Learning: In Next.js, nested `<a>` tags cause hydration issues due to invalid HTML. To fix this, avoid nesting `<a>` tags by replacing inner `<a>` tags with non-interactive elements like `<span>`, and use click handlers to maintain interactivity if needed.

Applied to files:

  • components/link.tsx
📚 Learning: 2025-12-29T14:21:28.216Z
Learnt from: sammy200-ui
Repo: asyncapi/website PR: 4804
File: components/navigation/Filter.tsx:32-41
Timestamp: 2025-12-29T14:21:28.216Z
Learning: In the asyncapi/website repository, when you intentionally omit dependencies in React hooks (e.g., useEffect, useMemo), add an eslint-disable comment with an explanatory note above the line to justify the design choice. For example: // eslint-disable-next-line react-hooks/exhaustive-deps: intentionally omitting dependencies to avoid unnecessary re-runs. This helps reviewers understand the rationale and keeps lint guidance informative.

Applied to files:

  • components/link.tsx
🪛 GitHub Actions: PR testing - if Node project
components/link.tsx

[error] 22-22: Prettier formatting issue. Replace ⏎··children,⏎··locale,⏎··target·=·'_self',⏎··rel·=·'',⏎··...props⏎ with ·children,·locale,·target·=·'_self',·rel·=·'',·...props· prettier/prettier


[error] 84-84: Prettier formatting issue. Replace ⏎··href,⏎··children,⏎··target·=·'_self',⏎··rel·=·''⏎ with ·href,·children,·target·=·'_self',·rel·=·''· prettier/prettier

⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website
  • GitHub Check: Lighthouse CI
🔇 Additional comments (4)
components/link.tsx (4)

7-13: LGTM! Interface correctly updated for modern Next.js.

The removal of legacyBehavior from the interface aligns with Next.js 15's deprecation of this prop and prepares the codebase for future Next.js versions where it will be removed entirely.


34-36: LGTM! Link components correctly updated for Next.js 15.

All three Link usages (lines 34, 55, and 78) correctly omit the deprecated legacyBehavior prop and render children directly without wrapping them in <a> tags, which is the correct pattern for Next.js 13+.

Also applies to: 55-57, 78-80


91-93: LGTM! LinkText correctly updated.

The Link component usage correctly omits legacyBehavior and follows the modern Next.js Link API.


22-28: No remaining legacyBehavior usage found in codebase.

Verification confirms that the legacyBehavior prop has been successfully removed from both LinkComponent and LinkText. The LinkComponentProps interface contains only children, locale, href, target, and rel properties. Zero matches found for legacyBehavior usage across the entire codebase.

@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (18ec38f) to head (7be940c).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #4871   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          798       798           
  Branches       146       146           
=========================================
  Hits           798       798           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants