WORK-344
ID:WORK-344Status:ready

Expose group metadata in collection item templates

When collection groups results, the per-item template can't see which group it belongs to or that group's size — so authors drop to aggregate for anything group-aware. Expose the group key (and count) on $item so grouped collections can render group context inline.

Priority:lowComplexity:simpleMilestone:v0.19.0Source:SPEC-070
changeset-release/main View source

Criteria completion

Criteria completion: 0 of 4 (0%) checked; tracking started on Jun 5, no incremental history yet0%25%50%75%100%Jun 5Jun 15

Tracking started Jun 5 — check back for trends.

Branches 3
History 2
  1. e1084e4
    Created (ready)by github-actions[bot]
  2. 33e11b7
    Content editedby Claude
    plan: shape v0.19.0 around polish, composability & rollups

Acceptance Criteria

  • In a grouped collection, the per-item template can read the item's group key (e.g. $item.group).
  • The group's size is available to the template (e.g. $item.groupCount).
  • Ungrouped collections are unaffected; existing templates keep working.
  • Tests cover a grouped template reading the group key and count.

Approach

In collection-resolve.ts, when grouping, bind the group key/count into the $item scope passed to transformDeferredTemplate for each item. Reuse the groupEntities output which already knows group membership.

References

  • packages/runes/src/collection-resolve.ts, collection-helpers.ts
  • SPEC-070