diff --git a/.changeset/honest-dots-jump.md b/.changeset/honest-dots-jump.md new file mode 100644 index 000000000000..9ae5d7f1c99f --- /dev/null +++ b/.changeset/honest-dots-jump.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes conflict between server islands and on-demand dynamic routes in the form of `/[...rest]` or `/[paramA]/[paramB]`. diff --git a/packages/astro/e2e/fixtures/server-islands/src/pages/[conflicting]/[dynamicRoute].astro b/packages/astro/e2e/fixtures/server-islands/src/pages/[conflicting]/[dynamicRoute].astro new file mode 100644 index 000000000000..d5ac0379ec76 --- /dev/null +++ b/packages/astro/e2e/fixtures/server-islands/src/pages/[conflicting]/[dynamicRoute].astro @@ -0,0 +1,14 @@ +--- +export const prerender = false; +--- + + + + Conflicting route + + + This route would conflict with the route generated for server islands. +
+ This file is here so the tests break if that happens. + + diff --git a/packages/astro/src/core/server-islands/endpoint.ts b/packages/astro/src/core/server-islands/endpoint.ts index 368a1b9b19ac..e6168b6e0ac6 100644 --- a/packages/astro/src/core/server-islands/endpoint.ts +++ b/packages/astro/src/core/server-islands/endpoint.ts @@ -44,7 +44,7 @@ export function ensureServerIslandRoute(config: ConfigFields, routeManifest: Man return; } - routeManifest.routes.push(getServerIslandRouteData(config)); + routeManifest.routes.unshift(getServerIslandRouteData(config)); } type RenderOptions = {