-
Notifications
You must be signed in to change notification settings - Fork 870
fix: use <a> tag for external rewrites instead of relying on Next's Link component #2707
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
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
…com/resend/react-email into fix/use-a-tag-for-external-rewrites
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 7 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="apps/web/src/components/smart-link.tsx">
<violation number="1" location="apps/web/src/components/smart-link.tsx:19">
`SmartLink` accepts UrlObject `href`s but the external rewrite check only handles strings, so `/docs` rewrites expressed as UrlObjects never hit the `<a>` fallback and the router bug remains.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| * https://resend.slack.com/archives/C05R55V6GBF/p1763739968845719?thread_ts=1763732012.356639&cid=C05R55V6GBF | ||
| */ | ||
| export function SmartLink({ href, ...props }: SmartLinkProps) { | ||
| const isExternalRewrite = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SmartLink accepts UrlObject hrefs but the external rewrite check only handles strings, so /docs rewrites expressed as UrlObjects never hit the <a> fallback and the router bug remains.
Prompt for AI agents
Address the following comment on apps/web/src/components/smart-link.tsx at line 19:
<comment>`SmartLink` accepts UrlObject `href`s but the external rewrite check only handles strings, so `/docs` rewrites expressed as UrlObjects never hit the `<a>` fallback and the router bug remains.</comment>
<file context>
@@ -0,0 +1,28 @@
+ * https://resend.slack.com/archives/C05R55V6GBF/p1763739968845719?thread_ts=1763732012.356639&cid=C05R55V6GBF
+ */
+export function SmartLink({ href, ...props }: SmartLinkProps) {
+ const isExternalRewrite =
+ typeof href === 'string' &&
+ EXTERNAL_REWRITE_PATHS.some((path) => href.startsWith(path));
</file context>
Summary by cubic
Switch external rewrite links to a plain anchor to fix broken navigation to docs on Next.js 16. Replaces Next’s Link in the menu with a SmartLink that falls back to Link for internal routes.
Written for commit 4d2ef6d. Summary will update automatically on new commits.