Skip to content

fix(ui): preserve the current page in translation links - #8739

Open
yuncic wants to merge 3 commits into
reactjs:mainfrom
yuncic:fix/preserve-translation-path
Open

yuncic wants to merge 3 commits into
reactjs:mainfrom
yuncic:fix/preserve-translation-path

Conversation

@yuncic

@yuncic yuncic commented Nov 6, 2026 •

Copy link
Copy Markdown

Summary

The Translations page doesn't keep track of the Learn or API Reference article a reader came from. After choosing a language, readers land on that language's homepage and have to find the article again.

This PR carries the article path into Translations. Selecting a language opens the matching article if it exists. If the article is missing or the check fails, the link goes to the selected language's homepage. Direct visits and in-progress languages keep their existing homepage links. Invalid from values are ignored.

Why

The Korean useLayoutEffect page exists at https://ko.react.dev/reference/react/useLayoutEffect, but the current link sends readers to the Korean homepage. A matching page isn't always available, though: none of the six sites listed under Full translations currently has React DevTools for agents. Checking the destination lets readers open existing translations without sending them to a 404 for missing pages. The existing Translations page stays in place, as discussed in #2255.

Validation

  • yarn check-all passed (existing no-img-element warnings).
  • git diff --check passed.
  • Local browser: the contextual Translations page generated redirect links for completed languages; in-progress languages kept homepage links.
  • Local HTTP checks: an existing Korean document redirected to the corresponding page; a missing Korean document and an invalid from value redirected to the Korean homepage; an invalid language returned 404.
  • Invalid from fallback: with from=//evil.com, all six completed translation links pointed to their respective language homepages; direct API requests returned 302 redirects to the same destinations.

AS-IS

2026-11-06.13.12.14.mov

TO-BE

2026-11-06.13.14.16.mov

Note

Translation links retain their existing new-tab behavior. Contextual links make one server-side HEAD request when clicked, with a two-second timeout; failed checks fall back to the language homepage.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 127.9 KB (🟡 +293 B) 243.05 KB
/500 127.91 KB (🟡 +293 B) 243.06 KB
/[[...markdownPath]] 130.38 KB (🟡 +293 B) 245.53 KB
/errors 128.15 KB (🟡 +293 B) 243.3 KB
/errors/[errorCode] 128.13 KB (🟡 +293 B) 243.28 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@yuncic yuncic changed the title Preserve the current document when choosing a translation fix(ui): preserve the current page in translation links Nov 6, 2026

This branch was successfully deployed

1 active deployment
Preview — 080f404a Deployed Nov 6, 2026 by vercel[bot]
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.

1 participant