Order of documents not working when using in predicate

Hi!

I'm trying to retrieve a list of documents by id using the in predicate. Based on the docs here Rest API Technical Reference - Prismic the order of the documents should be the same as the order in the in array.

This is how I'm doing the query

const categories = await client.query(
  [
    Prismic.Predicates.at("document.type", "category"),
    Prismic.Predicates.in("document.id", [
      "YZEuGhIAAC0ApnUV",
      "YZE-wRIAAC0Apr62",
      "YZE_hxIAACkApsI3",
      "YZE_zBIAACkApsNy",
      "YZFAJxIAAC0ApsUJ",
      "YZFAZBIAACwApsYZ",
      "YknJQxIAACwAt7So",
      "YkuhzhIAAC4Av9xg",
      "Ykm_nRIAAC8At4m8",
    ]),
  ],
  {
    graphQuery,
  }
)

And this is the order of the ids I get back

console.log(
  "🚀 ~ categories.results",
  categories.results.map(({ id }) => id)
)

🚀 ~ categories.results [
  'Ykm_nRIAAC8At4m8',
  'YZEuGhIAAC0ApnUV',
  'YkuhzhIAAC4Av9xg',
  'YZFAZBIAACwApsYZ',
  'YZE_zBIAACkApsNy',
  'YZFAJxIAAC0ApsUJ',
  'YZE_hxIAACkApsI3',
  'YknJQxIAACwAt7So',
  'YZE-wRIAAC0Apr62'
]

As you can see the order of the ids is completely different than the order given.

By the way I'm still using v5

Thank you!

Hello @levijesica

Thanks for reaching out to us.

in predicates returns the documents in the same order as the given array. Have you tested it in the API browser?

Thanks,
Priyanka

yes I did, and it does the same thing

Hello @levijesica

Could you please share the screenshot of the Api browser and the prismic repo name?

Thanks,
Priyanka