concrete/contract/display
Display entries declare one origin and legal cases, and every slot variant gate names a declared case.
Display entries declare one origin and legal cases, and every slot variant gate names a declared case.
Graded by the contracts stage of concrete check, in the contract venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
A section's display block declares up to two entries — whether the section shows,
and which variant it renders in — and four things about them cannot be stated on one
field, so they are checked across the block:
- an entry declares exactly one origin: a
computebinding or afilldecision decides it, never both and never neither; - its
fromcarries no duplicate case; visibilitydeclares exactly the two pinned cases, in either order — the first is the default and the failure posture — and takes nolocked, since a section's requiredness is the only visibility lock;- every slot gating on a variant case names a case the block actually declares.
The last is the one an author hits. A when: naming a case that does not exist gates
the slot on nothing: it is hidden in every case, with no error at render and nothing
in the editor to explain it.
Check-caught. when: is a plain string — the slot is written beside the display block
rather than under it, so no type relates the two.
Fix
Spell the case as the block declares it, or add it to the variant's from. Both
sides sit on the section options object.
Before and after
import { compute, fact, select, text } from "@homepages/concrete";
// display: { variant: … }
select({
from: ["classic", "editorial"],
source: compute({ reads: [fact.property.uploads] }, (uploads) => (uploads.some((asset) => asset.kind === "tour") ? "editorial" : "classic")),
locked: true,
});
// slots: { kicker: … }
text.short({ source: fact.property.listing_intent, label: "Kicker", when: "feature" });import { compute, fact, select, text } from "@homepages/concrete";
// display: { variant: … }
select({
from: ["classic", "editorial"],
source: compute({ reads: [fact.property.uploads] }, (uploads) => (uploads.some((asset) => asset.kind === "tour") ? "editorial" : "classic")),
locked: true,
});
// slots: { kicker: … }
text.short({ source: fact.property.listing_intent, label: "Kicker", when: "editorial" });