Skip to content

Sorting repeatable components isn't working through GraphQL #16874

@jbcrestot

Description

@jbcrestot

Bug report

Required System information

  • Node.js version: 14.19.3
  • NPM version: 8.13.0
  • Strapi version: 14.19.3
  • Database: postgresql
  • Operating system: mac 13.2.1
  • Is your project Javascript or Typescript: javascript

Describe the bug

I have a ContentType Dish with an attribute imageList :

image

this imageList attribute is a Component (repeatable) which have a number attribute (named upVote)

When I use GraphQL to request a Dish with its imageList, sorting this list by upVote isn't working.

image

Important :
sorting imageList by id is working :
image

Steps to reproduce the behavior

  1. Create a new contentType TestSort
  2. Add a repeatable component SortItem, with a number field "testNumber" inside .
  3. Save the contentType
  4. Create 1 entry for testSort , add 2-3 SortItem with different testNumber,
  5. try to fetch through graphQL
query {
  testSort(id: "1") {
    data {
      id
      attributes {
        SortItem(sort: "testNumber:desc") {
          id
          testNumber
          
        }
      }
    }
  }
}

Expected behavior

testSort should be returned with sortItem list sorted by testNumber

Metadata

Metadata

Labels

Type

No type

Projects

Status

Fixed/Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions