concrete/pages/composition-invalid
The composition the pages place breaks a page, canvas or instance rule.
The composition the pages place breaks a page, canvas or instance rule.
Graded by the composition stage of concrete check, in the probe venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
The composition is what the pages compose once the probe has read them: every placement and its instance id. An instance id is one section's identity on the artifact — it is what stored content, the editor's canvas and a fill are addressed to — so a composition where one id names two sections cannot be resolved into instances at all.
A row page is held to one more rule: its sections are
the panels of one printed side, so every one must print. A section on a row page that is
not required, or that declares a visibility rule, could drop out of the artifact and
shift every later panel onto the wrong fold.
What one section READS off another is graded separately, by the
relations/* family over the same composition.
Fix
Read the message, which names the conflict. Give each placement of a second section its
own instance. For a row page, declare the named section required: true and drop its
visibility rule; a panel with nothing to show draws itself empty instead.
Before and after
import { Section, section, Slot, text } from "@homepages/concrete";
const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section>
<Slot.Text slot={slot.headline} as="h1" />
</Section>
),
);
const Banner = section(
{ key: "banner", label: "Banner", slots: { line: text.short({ label: "Line" }) } },
({ slot }) => (
<Section>
<Slot.Text slot={slot.line} as="p" />
</Section>
),
);
// One instance id, two sections.
export const Home = () => (
<>
<Hero instance="band" />
<Banner instance="band" />
</>
);import { Section, section, Slot, text } from "@homepages/concrete";
declare const Hero: (props: { instance?: string }) => React.ReactNode;
declare const Banner: (props: { instance?: string }) => React.ReactNode;
export const Home = () => (
<>
<Hero instance="hero-band" />
<Banner instance="banner-band" />
</>
);