GraphQL dynamic zone Union query does not filter or sort data

System Information
  • 3.2.5:
  • linux:
  • postgres:
  • 12.16:
  • 6.13.4:
  • Y1.22:

—GraphQL dynamic zone Union query does not filter or sort data. I have a collection called Section and within that I have a dynamic zone called SectionGroups. Within that I added a component called FieldGroup. This component has a relation with a collection called Field. The attribute name is FieldList. If I add a sort or filter on FieldList it does not work. See the query below in bold what does not work => fieldLists( where : { key : “cycle_start_date”} )

Write your query or mutation here

query {
sections {
id
name
templateName
order
version
display
displayText
sectionGroups {

  ... on ComponentPanelComponentsSimpleCard {
    key
    title
    displayText
  }
  ... on ComponentDatasetComponentsDataTable{
    cols
    body     
  }
  ... on ComponentDatasetComponentsFieldGroup {
    key
    className
    label
    **fieldLists( where : { key : "cycle_start_date"} )**
    {
      id
      key
      order
      display   
    }
  }
}

}
}

Can you use code blocks to clean up your GraphQL query statement?

GraphQL dynamic zone Union query does not filter or sort data. I have a collection called Section and within that I have a dynamic zone called SectionGroups. Within that I added a component called FieldGroup. This component has a relation with a collection called Field. The attribute name is FieldList. If I add a sort or filter on FieldList it does not work. See the query below what does not work => fieldLists( where : { key : “cycle_start_date”} )

query {
sections {
id
name
templateName
order
version
display
displayText
sectionGroups {
  ... on ComponentPanelComponentsSimpleCard {
    key
    title
    displayText
  }
  ... on ComponentDatasetComponentsDataTable{
    cols
    body     
  }
  ... on ComponentDatasetComponentsFieldGroup {
    key
    className
    label
   fieldLists( where : { key : "cycle_start_date"} )
    {
      id
      key
      order
      display   
    }
  }
}

I have exactly the same problem. DynamicZone has proper graphql type but does not support limit, start, sort and where.

I am guessing this is a bug in Strapi and we may have to raise a defect.

You are correct, we don’t support filtering on components/DZs:

@DMehaffy Looks like there is no support… :worried:

Not currently, the backend DZ and components use polymorphic relations and we don’t currently support filtering on polymorphic relations. It’s not an easy thing to implement at the database level so it will take us some time and won’t likely happen until after our database refresh going on between this quarter and Q1 2021.

Any news about this feature (filtering / sorting dynamic zones)?

No we don’t plan to allow filtering/sorting on dyn zones (but we will have it for normal components)