Graphql default order change

Changes in: gapi Permalink

Attention: Storyblok’s GraphQL api will have a behavior change that will be published at 19.04.2022 to fix a bug of the sorting option of the Multi-Option field.

What will change?

Currently the content items inside a multi-option field are sorted by the position they are defined in the content browser.

{
  NavigationbarItems {
    items {
      name
      content {
        desktop_navigation_items {
          name
          uuid
        }
      }
    }
  }
}

In this query example the items inside “desktop_navigation_items” (Multi-options field) are sorted by the order they are visible in the content browser. But the multi-option field has a sorting function in the interface to let the user define a custom position. This custom position is currently not respected by the GraphQL api which is considered as a bug.

Sorting

After the change this custom position will be used to deliver the content items as the user defined it in the interface.

To bring back the old behavior and sort the items as they are in the content browser you can use the new parameter sort_by=default.

{
  NavigationbarItems {
    items {
      name
      content {
        desktop_navigation_items(sort_by: "default") {
          name
          uuid
        }
      }
    }
  }
}