Skip to content

Resolve "Repeat element: add current_record data provider support"

What is in this MR

This MR is the third step in getting the repeat element implemented. In this MR we refactor how applicationContext object is provided/injected in components, which ensures that in appropriate components we include the element and recordIndex (if the element is a collection element). This makes it possible for the RepeatElement to use the current_record data provider.

What is not in this MR

  1. The current_record provider will look for the first collection element ancestor of the element it's been given to find the correct list data source. If the element is already a collection element, we'll use that element's data source. The consequence of this is that you can nest RepeatElement, but you can only use the current_record of the immediate collection element, not any further up the chain. This will come in a future MR.
  2. It's not possible to nest a RepeatElement in a ColumnElement, the latter will prevent it. We can look at more nesting options in #2569 (closed).

How to test this MR

  • Create a page.
  • Add a list data source to it.
  • Add a repeat element to the page, connect it to the list data source.
  • Adding child elements to it, and in child elements, use the current_record provider in their formulas. Confirm it all repeats properly.
  • Add a repeat element inside a repeat element, with different data sources, confirm that the children of each repeat element only uses the current_record of their immediate repeat element ancestor. For example:
    • RepeatA (dataSourceA)
      • HeadingA (can repeat current_record of dataSourceA).
      • RepeatB (dataSourceB)
        • ColumnElement
          • HeadingB (can repeat current_record of dataSourceB).

Merge Request Checklist

  • changelog.md has been updated if required.
    • I'll make a changelog entry in the final MR.
  • New/updated Premium/Enterprise features are separated correctly in the premium or enterprise folder
  • The latest Chrome and Firefox have been used to test any new frontend features
  • Documentation has been updated
  • Quality Standards are met
  • Performance: tables are still fast with 100k+ rows, 100+ field tables
  • The redoc API pages have been updated for any REST API changes
  • Our custom API docs are updated for changes to endpoints accessed via api tokens
  • The UI/UX has been updated following UI Style Guide

Closes #2583 (closed)

Edited by Peter Evans

Merge request reports