Skip to content
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

allow bypassing client-side routing on link component #58209

Open
wants to merge 3 commits into
base: canary
Choose a base branch
from

Conversation

arichard-info
Copy link

@arichard-info arichard-info commented Nov 8, 2023

Add ability to disable client-side navigation at next/link component level

Use case :
In some cases, it may be wanted to disable client-side navigation on certain internal links :

  • When a classic page refresh is faster than client-side navigation
  • When you want to force the page to refresh

Why not replace <Link/> with a simple <a> tag?
We could actually replace next/link with simple <a> tags. But this has several disadvantages:

  • Unable to differentiate between internal/external links
  • Difficult migration: the native <a> and <Link /> do not have the same signature (passHref / LegacyBehavior etc…)

Adding a “nativeBehavior” property allows to keep next/link for all internal links, and have fine management of client-side navigation. You can also switch from one to the other very easily

@ijjk ijjk added the type: next label Nov 8, 2023
@arichard-info arichard-info marked this pull request as ready for review November 9, 2023 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants