Skip to content

refactor: simplify the route handling of the version dropdown - #9257

Open
ovflowd wants to merge 1 commit into
mainfrom
fix/download-keep-selection-on-version-change
Open

ovflowd wants to merge 1 commit into
mainfrom
fix/download-keep-selection-on-version-change

Conversation

@ovflowd

@ovflowd ovflowd commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Description

This PR simplifies how the version dropdown decides which download route a release belongs to.

The route for each release status is now a STATUS_ROUTE_MAP next to STATUS_KIND_MAP, replacing the string checks on the pathname (includes('current'), endsWith('/download'), ['LTS', 'EOL'].includes(...)). A single getRouteChange helper returns the route to move to, or nothing if we are already on it, and it is used by both the redirect on load and the version change handler.

There is no behaviour change. The one nuance is that the pathname is now compared exactly instead of with includes / endsWith.

Validation

The existing VersionDropdown tests are unchanged and pass: every status is checked for the redirect on load and for switching to every other status.

Related Issues

Refs: #9232, #9247

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

Copilot AI balanced review requested due to automatic review settings October 31, 2026 23:02
@ovflowd
ovflowd requested review from a team as code owners October 31, 2026 23:02
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nodejs-org Ready Ready Preview Oct 31, 2026 11:36pm UTC

Request Review

@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.89%. Comparing base (86d0195) to head (d05b99c).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...e/components/Downloads/Release/VersionDropdown.tsx 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9257      +/-   ##
==========================================
- Coverage   86.91%   86.89%   -0.02%     
==========================================
  Files          88       88              
  Lines        6334     6335       +1     
  Branches      381      380       -1     
==========================================
  Hits         5505     5505              
- Misses        825      826       +1     
  Partials        4        4              

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues requiring resolution.

No open issues 🎉

What changed in this PR

Preserves download-page selections when switching between release statuses on different routes, while retaining the initial route-normalization redirect.

Changes:

  • Updates the selected version in place and replaces the URL without navigating or adding a history entry.
  • Exports getPathname to construct localized URLs.
  • Updates version-switching tests and adds regression coverage for preserving ARM64 across route changes.
File Description
apps/​site/​navigation.mjs Exports the localized pathname helper.
apps/​site/​components/​Downloads/​Release/​VersionDropdown.tsx Replaces route-changing navigation with version and URL updates.
apps/​site/​components/​Downloads/​Release/​__tests__/​VersionDropdown.test.jsx Checks version updates and URL replacement instead of redirects.
apps/​site/​components/​Downloads/​Release/​__tests__/​PlatformDropdown.test.jsx Adds coverage for platform defaults and selection preservation.

Review effort: Balanced

@ovflowd
ovflowd force-pushed the fix/download-keep-selection-on-version-change branch from 8bedc58 to 2953916 Compare October 31, 2026 23:14
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Size Comparison

Summary

Metric Value
Old Total First Load JS 7.21 MB
New Total First Load JS 7.21 MB
Delta -164.00 B (-0.00%)

Changes

🔄 Modified Routes (4)
Route Old First Load JS New First Load JS Delta
/[locale] 1.69 MB 1.69 MB 📉 -41.00 B (-0.00%)
/[locale]/[...path] 1.69 MB 1.69 MB 📉 -41.00 B (-0.00%)
/[locale]/blog/[...path] 1.69 MB 1.69 MB 📉 -41.00 B (-0.00%)
/[locale]/download/archive/[version] 1.69 MB 1.69 MB 📉 -41.00 B (-0.00%)

@ovflowd
ovflowd force-pushed the fix/download-keep-selection-on-version-change branch from 2953916 to dd8bf39 Compare October 31, 2026 23:28
The route of each release status is now a STATUS_ROUTE_MAP next to
STATUS_KIND_MAP, instead of string checks on the pathname (includes,
endsWith and a status list). A single getRouteChange helper returns the
route to move to, or nothing when already on it, and is shared by the
redirect on load and the version change handler.

There is no behaviour change, except that the pathname is now compared
exactly.

Assisted-by: Claude Sonnet 5.5 <[email protected]>
@ovflowd ovflowd changed the title fix: keep download selections when the version changes route refactor: simplify the route handling of the version dropdown Oct 31, 2026
@ovflowd
ovflowd force-pushed the fix/download-keep-selection-on-version-change branch from dd8bf39 to d05b99c Compare October 31, 2026 23:35

This branch was successfully deployed

1 active deployment
Preview — d05b99c5 Deployed Oct 31, 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.

2 participants