Skip to content

Commit

Permalink
Fix generating page resources
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound committed Oct 22, 2024
1 parent bfeceb5 commit 3394eea
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/cli/src/prebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ export const prebuild = async (options: {
const instances: [Instance["id"], Instance][] =
siteData.build.instances.filter(([id]) => pageInstanceSet.has(id));
const dataSources: [DataSource["id"], DataSource][] = [];
const props: [Prop["id"], Prop][] = [];
const resourceIds = new Set<Resource["id"]>();
const resources: [Resource["id"], Resource][] = [];

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

const props: [Prop["id"], Prop][] = [];
for (const prop of normalizedProps) {
if (pageInstanceSet.has(prop.instanceId)) {
props.push([prop.id, prop]);
if (prop.type === "resource") {
resourceIds.add(prop.value);
}
}
}

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

const resources: [Resource["id"], Resource][] = [];
for (const [resourceId, resource] of siteData.build.resources ?? []) {
if (resourceIds.has(resourceId)) {
resources.push([resourceId, resource]);
Expand Down

0 comments on commit 3394eea

Please sign in to comment.