Skip to content

Commit 3394eea

Browse files
committed
Fix generating page resources
1 parent bfeceb5 commit 3394eea

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/cli/src/prebuild.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ export const prebuild = async (options: {
312312
const instances: [Instance["id"], Instance][] =
313313
siteData.build.instances.filter(([id]) => pageInstanceSet.has(id));
314314
const dataSources: [DataSource["id"], DataSource][] = [];
315+
const props: [Prop["id"], Prop][] = [];
316+
const resourceIds = new Set<Resource["id"]>();
317+
const resources: [Resource["id"], Resource][] = [];
315318

316319
// use whole project props to access id props from other pages
317320
const normalizedProps = normalizeProps({
@@ -323,14 +326,15 @@ export const prebuild = async (options: {
323326
source: "prebuild",
324327
});
325328

326-
const props: [Prop["id"], Prop][] = [];
327329
for (const prop of normalizedProps) {
328330
if (pageInstanceSet.has(prop.instanceId)) {
329331
props.push([prop.id, prop]);
332+
if (prop.type === "resource") {
333+
resourceIds.add(prop.value);
334+
}
330335
}
331336
}
332337

333-
const resourceIds = new Set<Resource["id"]>();
334338
for (const [dataSourceId, dataSource] of siteData.build.dataSources) {
335339
if (
336340
dataSource.scopeInstanceId === undefined ||
@@ -343,7 +347,6 @@ export const prebuild = async (options: {
343347
}
344348
}
345349

346-
const resources: [Resource["id"], Resource][] = [];
347350
for (const [resourceId, resource] of siteData.build.resources ?? []) {
348351
if (resourceIds.has(resourceId)) {
349352
resources.push([resourceId, resource]);

0 commit comments

Comments
 (0)