mirror of
https://github.com/withastro/astro.git
synced 2025-02-10 22:38:53 -05:00
fix(page-data): add key to allPages
This commit is contained in:
parent
b3028caecf
commit
9fcbe9503d
3 changed files with 8 additions and 5 deletions
|
@ -35,6 +35,8 @@ export async function collectPagesData(
|
||||||
// and is then cached across all future SSR builds. In the past, we've had trouble
|
// 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.
|
// with parallelized builds without guaranteeing that this is called first.
|
||||||
for (const route of manifest.routes) {
|
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:
|
// static route:
|
||||||
if (route.pathname) {
|
if (route.pathname) {
|
||||||
const routeCollectionLogTimeout = setInterval(() => {
|
const routeCollectionLogTimeout = setInterval(() => {
|
||||||
|
@ -47,8 +49,8 @@ export async function collectPagesData(
|
||||||
clearInterval(routeCollectionLogTimeout);
|
clearInterval(routeCollectionLogTimeout);
|
||||||
}, 10000);
|
}, 10000);
|
||||||
builtPaths.add(route.pathname);
|
builtPaths.add(route.pathname);
|
||||||
|
allPages[key] = {
|
||||||
allPages[route.component] = {
|
key: key,
|
||||||
component: route.component,
|
component: route.component,
|
||||||
route,
|
route,
|
||||||
moduleSpecifier: '',
|
moduleSpecifier: '',
|
||||||
|
@ -72,8 +74,8 @@ export async function collectPagesData(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// dynamic route:
|
// dynamic route:
|
||||||
|
allPages[key] = {
|
||||||
allPages[route.component] = {
|
key: key,
|
||||||
component: route.component,
|
component: route.component,
|
||||||
route,
|
route,
|
||||||
moduleSpecifier: '',
|
moduleSpecifier: '',
|
||||||
|
|
|
@ -21,6 +21,7 @@ export type StylesheetAsset =
|
||||||
| { type: 'external'; src: string };
|
| { type: 'external'; src: string };
|
||||||
|
|
||||||
export interface PageBuildData {
|
export interface PageBuildData {
|
||||||
|
key: string;
|
||||||
component: ComponentPath;
|
component: ComponentPath;
|
||||||
route: RouteData;
|
route: RouteData;
|
||||||
moduleSpecifier: string;
|
moduleSpecifier: string;
|
||||||
|
|
Loading…
Add table
Reference in a new issue