0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-03 22:29:08 -05:00

fix(page-data): add key to allPages

This commit is contained in:
Goulven Clec'h 2024-03-31 19:53:43 +02:00
parent b3028caecf
commit 9fcbe9503d
3 changed files with 8 additions and 5 deletions

View file

@ -35,6 +35,8 @@ export async function collectPagesData(
// and is then cached across all future SSR builds. In the past, we've had trouble
// with parallelized builds without guaranteeing that this is called first.
for (const route of manifest.routes) {
// Generate a unique key to identify each page in the build process.
const key = `${route.route}_${route.component}`;
// static route:
if (route.pathname) {
const routeCollectionLogTimeout = setInterval(() => {
@ -47,8 +49,8 @@ export async function collectPagesData(
clearInterval(routeCollectionLogTimeout);
}, 10000);
builtPaths.add(route.pathname);
allPages[route.component] = {
allPages[key] = {
key: key,
component: route.component,
route,
moduleSpecifier: '',
@ -72,8 +74,8 @@ export async function collectPagesData(
continue;
}
// dynamic route:
allPages[route.component] = {
allPages[key] = {
key: key,
component: route.component,
route,
moduleSpecifier: '',

View file

@ -21,6 +21,7 @@ export type StylesheetAsset =
| { type: 'external'; src: string };
export interface PageBuildData {
key: string;
component: ComponentPath;
route: RouteData;
moduleSpecifier: string;

View file

@ -6,4 +6,4 @@
"build": "astro build",
"preview": "astro preview"
}
}
}