Concrete
Rulescontract

concrete/contract/source

Every slot and item field source names a known fact, another slot or its own compute binding; the uploads are read, never bound.

Every slot and item field source names a known fact, another slot or its own compute binding; the uploads are read, never bound.

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 binding says where a slot's value comes from, and the catalog decides what each binding may be attached to. Six things are checked, on every slot and on every field of an object or a list's item:

  • the bound field is one the catalog declares, and no source or reads entry names a table's row by position (fact.property.units[1].beds): a list is read whole, so one row of a table is a row, whose members contract/row-rule grades;
  • an image field sits on an image slot, because that is where an image value can land;
  • the whole address (fact.property.address) sits on an address slot, and an address slot binds no other fact: the address is one place, and a line of it is a formatting — a compute() over the address, which concrete upgrade writes for a text slot bound to it;
  • a fact table sources a list or is a row's from, never one value slot: a table's row is many values, and one member of one row is what sits on one slot;
  • the property's media lists (fact.property.uploads, fact.property.property_media, fact.property.floor_plans, fact.property.property_documents) source no slot, a list included: they are read whole, by a compute() or a fill, and a media slot or a list of media is picked out of the one it names as its from (from: fact.property.property_media with a fill.pick) or computed;
  • every field of a record item declares its own origin: a member of its row, a compute() or a fill. A row field bound straight to a catalog field, or one with no origin at all, is the implicit form a Concrete older than 7.0.0 built, which the platform does not read.

A derived binding is the section's own compute callback, keyed by the slot it sits on. Where an edit to a bound slot goes is declared nowhere: it follows from the binding (where an edit goes).

Type-caught for the field name: fact.* only spells fields the catalog declares. Check-caught for the rest, because which slot kind a field may sit on is catalog data, not part of a binding's type.

Fix

Put the binding on a slot that can hold its value. A table read by position is a computed row of the table — const agent = row({ label: "Agent", from: fact.property.contacts, source: compute({ reads: [fact.property.contacts] }, (contacts) => contacts[0] ?? null) }) — and the slot reads agent.phone off it, which follows the order the contacts hold and writes back to the contact it shows. For a section an older Concrete built, run concrete upgrade. The namespace is fact.

Before and after

// An image member on a text slot: the compiler rejects it, as the rule does.
// @noErrors
import { fact, row, text } from "@homepages/concrete";

const contact = row({ label: "Contact", from: fact.property.contacts, locked: true });

text.short({ source: contact.headshot, label: "Agent photo" });
import { fact, image, row } from "@homepages/concrete";

const contact = row({ label: "Contact", from: fact.property.contacts, locked: true });

image({ source: contact.headshot, label: "Agent photo" });

On this page