Skip to content

fix(routing): prefix roots should point to root#8554

Merged
wmertens merged 1 commit intobuild/v2from
explicit-rewrite-roots
Apr 13, 2026
Merged

fix(routing): prefix roots should point to root#8554
wmertens merged 1 commit intobuild/v2from
explicit-rewrite-roots

Conversation

@wmertens
Copy link
Copy Markdown
Member

fixes #8504

@wmertens wmertens requested a review from a team as a code owner April 13, 2026 17:05
Copilot AI review requested due to automatic review settings April 13, 2026 17:05
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 13, 2026

⚠️ No Changeset found

Latest commit: 28e9723

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a regression in rewriteRoutes (v2 beta) where a prefixed locale root (e.g. /en/) no longer rewrote to the app root route, by treating an empty-string _G rewrite target as a valid rewrite.

Changes:

  • Update runtime routing logic to treat _G: "" as present (nullish checks instead of truthiness checks).
  • Update build-time trie serialization to emit _G even when it’s an empty string.
  • Add a unit test covering the “prefix root rewrites to index” scenario.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/qwik-router/src/runtime/src/routing.unit.ts Adds coverage ensuring _G: "" rewrites /en and /de to the root index.
packages/qwik-router/src/runtime/src/routing.ts Fixes rewrite detection by using nullish checks so empty-string rewrites work.
packages/qwik-router/src/buildtime/runtime-generation/generate-routes.ts Ensures _G is serialized into the generated trie even when _G === "".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 13, 2026

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8554

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@8554

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@8554

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@8554

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@8554

commit: 28e9723

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 28e9723

Copy link
Copy Markdown
Member

@Varixo Varixo left a comment

Choose a reason for hiding this comment

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

LGTM

@wmertens wmertens merged commit 5c018ff into build/v2 Apr 13, 2026
33 checks passed
@wmertens wmertens deleted the explicit-rewrite-roots branch April 13, 2026 19:21
@github-project-automation github-project-automation bot moved this from Waiting For Review to Done in Qwik Development Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants