fix(routing): prefix roots should point to root#8554
Conversation
|
There was a problem hiding this comment.
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
_Geven 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.
@qwik.dev/core
@qwik.dev/router
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
commit: |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
fixes #8504