Problem with repeat elements logic/terminology

REPEAT ELEMENT - After working with repeat elements more often recently, I have some suggestions regarding the current logic or maybe terminology.

When an element is repeated based on a collection of objects with meaningful data (like products products), by default the currentItem is a reference to the current repeated object (product). This makes sense when the value of the repeat is the data of the objects (in the case of products, you may need details/data about the product - id, name, price, color, etc.).

However, sometimes an element may be repeated based on a collection that doesn’t provide repeat “value” in terms of data, other than determining the number of repeats. In this case, it is likely that the focus of repeat is the element itself which may have various states and props that may need to displayed or changed based on other data/logic.

If so, the currentItem variable is not at all useful and I would argue it may be even confusing, since it may lead to believe it refers to the current repeated element - which it doesn’t.

I would suggest that the repeat logic and interface (see idea mockups attached) be enhanced to be more indicative of the intention behind what is being repeated: the items in the collection or the element.

This would allow to vary the logic on two levels:

  1. The default naming - currentItem would be more representative of what’s being repeated, like currentCollectionItem/currentCollectionIndex (when repeating based on data of objects in a collection) or currentElement/currentElementIndex (when repeating only based on the number of objects in a collection).
  2. The data of each repeat item - in the case of repeating the element, the data would not be the data of each object in a collection, but instead any props and states of each element repeated. So instead of using $state.repeatElementName[currentIndex].repeatElementState (which is how it’s done currently), we could simply use currentElement.someState .

Let me know if this makes any sense or if I should focus on shoveling snow instead.