-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[🐞] translated routes from rewriteRoutes get ignored for [...catchall] route in same folder #5665
Comments
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 |
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
The text was updated successfully, but these errors were encountered: