-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
custom integration: injected catch-all route overwrites local routes #6221
Comments
Closing as a duplicate of #3602 |
@Princesseuh are you sure this is a duplicate? Usually, inside src/pages you can create a file called '[...args].Astro' and the same directory 'index.Astro'. the index will be served when requesting '/' and this is correct. But as soon as an integration registers the pattern '[...args]' this system breaks. Index is no longer served. |
Ah yes, sorry! I misread the issue, re-opening! |
Hi @Princesseuh, since this is quite important to me I would love to help fixing this. Could you or somebody else in the team point me towards where the logic for this sits in the code? I´d be happy to create a PR :) |
I believe @bluwy has the necessary context to help with this, though you might have to wait until the work week start for an answer from him. |
It looks like injected route taking the highest priority is an intentional decision: astro/packages/astro/src/core/routing/manifest/create.ts Lines 430 to 443 in 869197a
The PR that added it is #4087. I think what we need is a middleground where injected routes are sorted together with user routes, but injected routes take higher priority than user routes when they have equal priority, e.g. I'm not sure how that can be achieved. Looks like it'll take some leg work to combine both sorted routes, but if you're interested in taking a look, the linked code above (injected routes sorting) and this user routes sorting code would be the place to start tweaking. |
Thanks a lot! I'll definitely check it out and see what I can come up with. The middle ground as you mentioned sounds good to me. |
This should be fixed now. Closing. If you still have the issue, please create a new issue with a more recent version of Astro |
What version of
astro
are you using?2.0.10
Are you using an SSR adapter? If so, which one?
Vercel (error on dev)
What package manager are you using?
yarn
What operating system are you using?
mac
Describe the Bug
I´m injecting a "catch-all" route
[...slug]
inside a custom integration. When doing this all other routes I create inside my pages folder can not be found.I guess something is wrong in the prioritisation.
I´m willing to help fix this if someone can point me to the right direction in code.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-g758sr?file=astro.config.ts
Participation
The text was updated successfully, but these errors were encountered: