Concrete
Rulessections

concrete/sections/whole-table-read

A `compute()` reads a whole table (`fact.property.units`), which counts every member of the table as used. Where the value needs only some members, reading those columns (`fact.property.units.beds`) narrows what the template asks of a property. A hint: it never fails `check`.

A compute() reads a whole table (fact.property.units), which counts every member of the table as used. Where the value needs only some members, reading those columns (fact.property.units.beds) narrows what the template asks of a property. A hint: it never fails check.

Graded by the sections stage of concrete check, in the tree (warning) venue. A violation reports this id and the file it failed at — see every rule and concrete check.

Reason

What a template reads is what the platform asks of a property. A compute() reading a whole table — fact.property.units — is shown every member of every row, so every member counts as used: intake asks the seller for each one, though the callback may only ever touch two. Reading the columns it needs — fact.property.units.beds, one member over every row — states exactly what the value depends on. The platform cannot see inside the callback to narrow the read for you, so this is a hint, never a failure: a callback that genuinely needs the whole row keeps the whole-table read.

Fix

If the callback reads only some members of each row, read those columns instead. Each column arrives as an array in row order, null where a row leaves the member unanswered.

Before and after

import { compute, fact, Section, section, Slot, text } from "@homepages/concrete";

// Reads every member of every unit, so the template asks for all of them.
export const Stats = section(
  {
    key: "stats",
    label: "Stats",
    slots: {
      beds: text.short({
        label: "Beds",
        source: compute({ reads: [fact.property.units] }, (units) => units.map((unit) => String(unit.beds ?? "–")).join(" / ")),
      }),
    },
  },
  ({ slot }) => (
    <Section>
      <Slot.Text slot={slot.beds} as="p" />
    </Section>
  ),
);
import { compute, fact, Section, section, Slot, text } from "@homepages/concrete";

export const Stats = section(
  {
    key: "stats",
    label: "Stats",
    slots: {
      beds: text.short({
        label: "Beds",
        source: compute({ reads: [fact.property.units.beds] }, (beds) => beds.map((n) => String(n ?? "–")).join(" / ")),
      }),
    },
  },
  ({ slot }) => (
    <Section>
      <Slot.Text slot={slot.beds} as="p" />
    </Section>
  ),
);

On this page