Skip to content
Toolkit

ADR-0058 — A repeat binding counts where the block counts

  • Status: Accepted
  • Date: 2026-08-24
  • Deciders: Repository owner, track 003 phase 02 (d)
  • Follows: ADR-0055 (the render spec is a crosswalk), ADR-0057 (the render path is Cardsite's React; the label is served)

Context

The renderer census left one gap open through every slice of phase 02 (d): repeat-over-items. Four arms — image_grid, image_slider, faq, timeline — store their list as JSON in a single setting and map over it at render time. Their length is whatever the page's owner typed; no descriptor can know it.

The binding grammar could only spell a list the descriptor already counted: items.<n>.<field>, fixed at authoring time (items.0.src, items.1.src for a before-and-after pair). That form was kept deliberately narrow so the repeat slice would not be pre-empted by an approximation — a descriptor that guessed "three images" would render the wrong number of pictures on every page that had four.

Decision

The repeat is a second key form, not a widening of the first, and it names a source rather than an arity:

"props": {
  "items[]":       "settings.images",
  "items[].src":   "entry"
}
  • items[] is the source: an ordinary binding naming the setting that holds the list. Its presence is what makes the prop a repeat.
  • items[].<field> binds one field per entry, in the entry's own scope, through two new grammar sources: entry.<field>, and bare entry for a list of plain strings.

A descriptor uses one form or the other. Mixing them would claim two arities for one prop, so hasRepeat chooses, and resolveRepeat is the only reader.

Three consequences we accept deliberately:

  1. The blob's tolerance is preserved, not corrected. Each arm accepted a JSON string or an already-parsed array and answered malformed input with an empty list. The repeat does the same. A settings blob is data a visitor must never watch fail; the block's other content still has to draw.
  2. Entry fields resolve to strings only. A number or a nested object in the blob resolves empty, exactly as the arms' JSX did when it interpolated one.
  3. entry is empty outside a repeat. A descriptor that reaches for an entry where there is no list gets nothing, never a value borrowed from the block.

Consequences

image_grid migrates on this ADR as the first repeat descriptor, taking a third image-gallery variant (grid) beside single and pair. The other three follow one kind each: image_slider (kit carousel), faq (kit faq), timeline (kit timeline) — each now a mechanical slice rather than a blocked one.

socials is the near miss. It repeats too, but over every settings entry except one, not over a list stored in a named setting. That is a different source — an object's own keys — and it stays unexpressible here rather than bending items[] to accept "the settings map minus color". Whether the block should keep deriving its rows that way is a product question, not a grammar one.

The kit's own page.json expresses its lists as arrays of objects inline, so nothing here contradicts the crosswalk: the repeat says where Cardsite keeps the same list. It goes to the upstream feed as a question, not a patch — whether the kit intends a data-bound list at all (ADR-0031).

Source: docs/decisions/0058-a-repeat-binding-counts-where-the-block-counts.md

Library