[PR #367] [MERGED] fix(link): use localized href for SPA navigation #515

Closed
opened 2026-05-06 13:08:29 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/367
Author: @NathanDrake2406
Created: 3/9/2026
Status: Merged
Merged: 3/9/2026
Merged by: @james-elicx

Base: mainHead: fix/link-locale-navigation-v2


📝 Commits (1)

  • 0fe7b14 fix(link): use localized href for SPA navigation and onNavigate callback

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 packages/vinext/src/shims/link.tsx (+2 -2)

📄 Description

Summary

  • next/link's locale prop correctly affected the rendered <a> href and prefetch path, but SPA click navigation and the onNavigate callback used the non-localized resolvedHref
  • Clicking <Link href="/about" locale="fr"> would render <a href="/fr/about"> and prefetch /fr/about, but SPA-navigate to /about
  • Fixed by using localizedHref instead of resolvedHref in the click handler (line 370) and onNavigate callback (line 386)

Test plan

  • Existing link.test.ts locale tests pass (36/36)
  • Typecheck clean
  • Lint clean
  • CI

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/367 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 3/9/2026 **Status:** ✅ Merged **Merged:** 3/9/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/link-locale-navigation-v2` --- ### 📝 Commits (1) - [`0fe7b14`](https://github.com/cloudflare/vinext/commit/0fe7b14bf8a0b9e3f4a0c32801f8110fe6869c1d) fix(link): use localized href for SPA navigation and onNavigate callback ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/link.tsx` (+2 -2) </details> ### 📄 Description ## Summary - `next/link`'s `locale` prop correctly affected the rendered `<a>` href and prefetch path, but SPA click navigation and the `onNavigate` callback used the non-localized `resolvedHref` - Clicking `<Link href="/about" locale="fr">` would render `<a href="/fr/about">` and prefetch `/fr/about`, but SPA-navigate to `/about` - Fixed by using `localizedHref` instead of `resolvedHref` in the click handler (line 370) and `onNavigate` callback (line 386) ## Test plan - [x] Existing `link.test.ts` locale tests pass (36/36) - [x] Typecheck clean - [x] Lint clean - [x] CI --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:29 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#515
No description provided.