Primitives / foldkit-primitives/state

MeasureRows

const · packages/primitives/src/state/virtual.ts:505

const MeasureRows: Mount.MountDefinitionWithArgs<
  'MeasureRows',
  { attribute: Schema.String },
  {
    readonly _tag: 'RowsMeasured'
    readonly rows: readonly { readonly key: string; readonly height: number }[]
  }
>

The heights of an element's rows, border boxes, from one observer on the list rather than a Mount per row: each child carrying attribute is a row, its value the row's key. A row is reported when it is drawn and on every resize after, and the rows one frame resized arrive in one batch, so a list's first draw is one Message, not one per row. The rows already drawn when it starts are read at once, and reported first, as a batch that may be empty: a row the next frame takes away would otherwise go before the observer's first report. A row of no height is left to the observer.

In the guides