Skip to content

fix(docs): preserve query and hash in version redirects - #2415

Open
rahimahisah17 wants to merge 1 commit into
nuxt:mainfrom
rahimahisah17:fix/2060-redirect-url-hash
Open

fix(docs): preserve query and hash in version redirects#2415
rahimahisah17 wants to merge 1 commit into
nuxt:mainfrom
rahimahisah17:fix/2060-redirect-url-hash

Conversation

@rahimahisah17

Copy link
Copy Markdown

Linked Issue

Closes #2060

Description

This change updates the documentation version redirect middleware to preserve the URL query parameters and hash fragment when redirecting to the current documentation version.

Previously, the redirect rebuilt the URL from to.fullPath, which could result in the URL hash being lost during the redirect.

The redirect now passes path, query, and hash explicitly to navigateTo().

Testing

  • pnpm exec playwright test test/browser/pages.spec.ts --timeout=60000
  • 3 tests passed
  • 1 test skipped (existing blog navigation test)
  • 0 tests failed
  • git diff --check passes

@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@rahimahisah17 is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 00ca56f1-5e40-4dab-9efe-cfce54c126a6

📥 Commits

Reviewing files that changed from the base of the PR and between 9e0c8e8 and c8101dd.

📒 Files selected for processing (1)
  • app/middleware/docs-version.global.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The documentation version middleware now redirects with a route object. The object adds the documentation version to the path and preserves the query parameters and hash. The redirect remains a 302 response.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to c8101

Documentation version redirects now retain query parameters and hash fragments while adding the current version path. No merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the documentation redirect fix and the preservation of query parameters and hash fragments.
Description check ✅ Passed The description directly explains the redirect change, the hash preservation issue, and the completed tests.
Linked Issues check ✅ Passed The change addresses issue #2060 by preserving the URL hash during documentation version redirects. It also preserves query parameters by passing path, query, and hash explicitly to navigateTo().
Out of Scope Changes check ✅ Passed The changes are limited to the documentation version redirect middleware and directly support issue #2060. No unrelated changes are identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nuxt-com-bundle-report

Copy link
Copy Markdown

Production bundle

Comparing 9e0c8e8b with c8101ddf. Compressed sizes are calculated from the emitted production assets.

Metric Base (Brotli) PR (Brotli) Δ Brotli Δ gzip
Client JavaScript 2.54 MiB 2.54 MiB -41 B (-0.0%) +8 B (+0.0%)
Client CSS 30.3 KiB 30.3 KiB
Other client assets 339.3 KiB 339.3 KiB -4 B (-0.0%) +2 B (+0.0%)
Total client assets 2.90 MiB 2.90 MiB -45 B (-0.0%) +10 B (+0.0%)

Largest module increases

Module Base (Brotli) PR (Brotli) Δ Brotli
/app/pages/docs/async-data-chunk-8.js 0 B 180 B +180 B
/app/pages/blog/async-data-chunk-2.js 0 B 169 B +169 B
/app/pages/docs/async-data-chunk-7.js 0 B 168 B +168 B
/app/pages/docs/[version]/errors/async-data-chunk-0.js 0 B 152 B +152 B
/app/pages/deploy/async-data-chunk-4.js 0 B 134 B +134 B
/app/pages/enterprise/agencies/async-data-chunk-6.js 0 B 120 B +120 B
/app/pages/deploy/async-data-chunk-3.js 0 B 119 B +119 B
/app/pages/async-data-chunk-19.js 0 B 117 B +117 B
/app/pages/blog/async-data-chunk-5.js 0 B 114 B +114 B
/app/pages/async-data-chunk-20.js 0 B 113 B +113 B

Module values come from Nuxt’s analyzer and are attribution estimates. This workflow is currently report-only.

Workflow run

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
nuxt Ready Ready Preview Sep 8, 2026 10:47am UTC

Request Review

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.

Redirection adding Nuxt version to documentation loses URL hash

1 participant