0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

SSR doesn't need to block multiple routes that match the same URL (#4329)

* fix: SSR doesn't need to block multiple routes that match the same URL

* chore: add changeset
This commit is contained in:
Tony Sullivan 2022-08-15 17:57:10 +00:00 committed by GitHub
parent fbf9752f17
commit 0274b8d47b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Updates routing logic to allow multiple routes to match the same URL in SSR

View file

@ -251,13 +251,6 @@ async function handleRequest(
async function matchRoute() {
const matches = matchAllRoutes(pathname, manifest);
if (config.output === 'server' && matches.length > 1) {
throw new Error(`Found multiple matching routes for "${pathname}"! When using \`output: 'server'\`, only one route in \`src/pages\` can match a given URL. Found:
${matches.map(({ component }) => `- ${component}`).join('\n')}
`);
}
for await (const maybeRoute of matches) {
const filePath = new URL(`./${maybeRoute.component}`, config.root);
const preloadedComponent = await preload({ astroConfig: config, filePath, viteServer });