Closed denisyilmaz closed 5 months ago
Indeed, that can be considered a bug. Would you be interested in contributing a PR? The rewrites should happen before the route matching.
Alright, thanks for the confirmation that this is not an expected behavior. I hope to find some time the next few days to dig into this!
Damn, I was going to write exactly this issue. Will take a look if I can create a PR. Any clue @wmertens
Thanks
This is where routes are matched, you can look up the call chain from there. https://github.com/BuilderIO/qwik/blob/302b27eb7f6cd9c7e47c70cdfcf478c13c916faf/packages/qwik-city/middleware/request-handler/request-handler.ts#L20
This is where routes are matched, you can look up the call chain from there.
Hi @wmertens , thanks for the tip. I finally realised the issue was at build time, as the rewritten routes were pushed at the end of the routes array, instead of the original route + 1 index.
Hope its all good and it can be merged soon!
Which component is affected?
Qwik City (routing)
Describe the bug
I have the following routing folder structure:
The paths
/en/projects
//de/projects
are correctly rendered by theprojects
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:Expected behavior:
/de/projekte/some-projekt
should be rendered via theprojects
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 therewriteRoutes
is working correctly though.It seems that the
catchall
routes are matched before the routes defined via therewriteRoutes
config. Is this an expected behavior or is there a way to prioritise therewriteRoutes
?Reproduction
https://stackblitz.com/edit/qwik-starter-jnup5o?file=vite.config.ts
Steps to reproduce
catchall
route[...uri]
route folderprojects
routeSystem Info
Additional Information
No response