qwik
qwik copied to clipboard
[🐞] translated routes from rewriteRoutes get ignored for [...catchall] route in same folder
Which component is affected?
Qwik City (routing)
Describe the bug
I have the following routing folder structure:
- [lang]
- [...uri]
- projects
The paths /en/projects
//de/projects
are correctly rendered by the projects
route folder.
Any other urls /en/some-page
or /de/example/some-other-sub-path
get correctly rendered by the [...catchall]
route folder.
For better i18n for the application i know wanted to use the new rewriteRoutes
feature and added the following:
qwikCity({
rewriteRoutes: [
{
prefix: '',
paths: {
'projects': 'projekte'
},
},
],
})
Expected behavior:
/de/projekte/some-projekt
should be rendered via the projects
route folder.
Actual behavior:
Unfortunately this is not the case but i can see the catchall
route is used instead. When deleting the catchall route from the folder structure the rewriteRoutes
is working correctly though.
It seems that the catchall
routes are matched before the routes defined via the rewriteRoutes
config. Is this an expected behavior or is there a way to prioritise the rewriteRoutes
?
Reproduction
https://stackblitz.com/edit/qwik-starter-jnup5o?file=vite.config.ts
Steps to reproduce
- open reproduction
- visit: https://qwikstarterjnup5o-s2um--5173--a2aabdd9.local-credentialless.webcontainer.io/de/projects
- visit: https://qwikstarterjnup5o-s2um--5173--a2aabdd9.local-credentialless.webcontainer.io/de/projects/someproject
- visit: https://qwikstarterjnup5o-s2um--5173--a2aabdd9.local-credentialless.webcontainer.io/de/somepage/test
- visit: https://qwikstarterjnup5o-s2um--5173--a2aabdd9.local-credentialless.webcontainer.io/de/projekte/someproject
- it renders the
catchall
route
- it renders the
- delete or rename the
[...uri]
route folder - visit: https://qwikstarterjnup5o-s2um--5173--a2aabdd9.local-credentialless.webcontainer.io/de/projekte/someproject
- it renders the
projects
route
- it renders the
System Info
System:
OS: macOS 14.2.1
CPU: (10) arm64 Apple M1 Max
Memory: 2.74 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.15.0/bin/yarn
npm: 8.15.1 - ~/.nvm/versions/node/v16.15.0/bin/npm
Browsers:
Chrome: 120.0.6099.199
Edge: 119.0.2151.46
Safari: 17.2.1
npmPackages:
@builder.io/qwik: ^1.3.2 => 1.3.2
@builder.io/qwik-city: ^1.3.2 => 1.3.2
@builder.io/sdk-qwik: ^0.7.5 => 0.7.5
undici: 5.26.0 => 5.26.0
vite: 4.4.9 => 4.4.9
Additional Information
No response