Allow parameters on slice repeatable zone field

I'd like to see the same options (particularly limiting, e.g. to the first 3 entries, but also filtering) that fields like all<ContentType>s have, on the repeatable zone field on slices.

Example:

My Page type has a slice called user_stories, and this slice has a repeatable zone with various fields inside.

I am able to limit and filter a query for allPages such as allPages(first: 3) { ... } or filter such as allPages(where: { ... }) { ... }.

But I can't do these operations on the slice's repeatable zone.

page(...) {
  body {
    ...on PageUser_stories {
      fields(first: 3) { ← no such parameters 
        my_field
      }
    }
  }
}

My use case is a slice which is a spotlight on some particular pages of the website. When rendered it will only ever display a maximum of 3. I can't limit the number of items in the repeatable slice in Prismic but this is fine, since the client will find it useful to enter the data for more than 3, and swap them in and out from time to time by reordering them.

I ideally don't want the application to load more data than it needs to -- I'd like it to just query for the first 3.

Hey Bart, thanks for sharing your use case. As you mentioned before, it is not possible to add this type of filter for Slices. It is only possible to add arguments in the top node of the query, in your case allPages. The alternative would be to filter them in the front-end to only render the first three elements.

This is a feature request.

I've added a feature request tag so the product team can see it. :slightly_smiling_face:

1 Like

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.