Implement independent presentation readiness boundaries
This commit is contained in:
@@ -147,9 +147,6 @@ export async function expandPresentationQueries(workspace: WorkspaceRevision): P
|
||||
for (const child of children)
|
||||
for (const branch of child.branches) await expandModule(identity(branch.packageRevision, branch.id));
|
||||
const composition = pkg.queryCompositions!.find((entry) => entry.id === preparation.composition)!;
|
||||
const discovery = { ...composition, id: composition.id + ":discovery" };
|
||||
preparation.discoveryComposition = discovery.id;
|
||||
pkg.queryCompositions!.push(discovery);
|
||||
const steps = structuredClone(composition.steps);
|
||||
const exported: { step: string; query: CheckedQuery }[] = [];
|
||||
for (const step of steps) {
|
||||
@@ -187,7 +184,12 @@ export async function expandPresentationQueries(workspace: WorkspaceRevision): P
|
||||
(entry) => entry.packageRevisionId === branch.packageRevision && entry.fragmentId === declaration.id,
|
||||
)
|
||||
) {
|
||||
imports.push({ packageRevisionId: branch.packageRevision, fragmentId: declaration.id, variables: {} });
|
||||
imports.push({
|
||||
packageRevisionId: branch.packageRevision,
|
||||
fragmentId: declaration.id,
|
||||
variables: {},
|
||||
mode: "reference",
|
||||
});
|
||||
}
|
||||
selection = insert(selection, path, declaration.fragment!.name);
|
||||
const admission = admissionFragments.get(identity(branch.packageRevision, declaration.id))!;
|
||||
@@ -203,6 +205,18 @@ export async function expandPresentationQueries(workspace: WorkspaceRevision): P
|
||||
variables: {},
|
||||
});
|
||||
admissionSelection = insert(admissionSelection, path, admission.declaration.fragment!.name);
|
||||
if (
|
||||
!admissionImports.some(
|
||||
(entry) => entry.packageRevisionId === branch.packageRevision && entry.fragmentId === declaration.id,
|
||||
)
|
||||
)
|
||||
admissionImports.push({
|
||||
packageRevisionId: branch.packageRevision,
|
||||
fragmentId: declaration.id,
|
||||
variables: {},
|
||||
mode: "reference",
|
||||
});
|
||||
admissionSelection = insert(admissionSelection, path, declaration.fragment!.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,13 +351,7 @@ export async function expandPresentationQueries(workspace: WorkspaceRevision): P
|
||||
{ id: composition.id, input: composition.input, steps, maxQueries: composition.maxQueries },
|
||||
available,
|
||||
);
|
||||
const checkedDiscovery = compileQueryComposition(
|
||||
{ id: discovery.id, input: discovery.input, steps: discovery.steps, maxQueries: discovery.maxQueries },
|
||||
available,
|
||||
);
|
||||
pkg.queryCompositions = pkg.queryCompositions!.map((entry) =>
|
||||
entry.id === composition.id ? checked : entry.id === discovery.id ? checkedDiscovery : entry,
|
||||
);
|
||||
pkg.queryCompositions = pkg.queryCompositions!.map((entry) => (entry.id === composition.id ? checked : entry));
|
||||
eager.set(key, exported);
|
||||
done.add(key);
|
||||
}
|
||||
@@ -411,6 +419,7 @@ export async function expandPresentationQueries(workspace: WorkspaceRevision): P
|
||||
packageRevisionId: input.pkg.revisionId,
|
||||
fragmentId: input.query.declaration.id,
|
||||
variables: {},
|
||||
...(original.declaration.placement?.kind === "local" ? { mode: "reference" as const } : {}),
|
||||
})),
|
||||
},
|
||||
print({ ...document, definitions }),
|
||||
|
||||
Reference in New Issue
Block a user