Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andreas Jacobsen 9 posts 60 karma points
    Jul 24, 2023 @ 13:35
    Andreas Jacobsen
    0

    pages from GraphQL are ordered by last edited instead of the order the appear in backoffice

    I use GraphQL to get all my data from Umbraco. I thought data would be served in the order data appears in Umbraco Backoffice. This is also what the docs say

    If orderBy is not specified the collections are ordered by path which is the order they appear in, in the Umbraco Backoffice tree. https://docs.umbraco.com/umbraco-heartcore/api-documentation/graphql/filtering-and-ordering

    But it turns out that whatever is edited last comes on the bottom of the page. This completly breaks how we have made our site.

    Right now this problem most affects our audits part of our CMS. We do audits and each audit can be hundreds of pages long (on the web page, if exported to PDF)

    screenshot of nested WCAG structure

    The screenshot shows how we do audits, you don't have to understand the Norwegian letters but the structure shown in studio is what I expect in my front end (order wise) Instead whatever is edited last comes last on our page.

    My GraphQL query for getting this data looks like this

       query($url: String!) {
            content(url: $url) {
              id
              name
              level
              ... on Granskning {
                oppsumering
                level
              }
              descendants {
                items {
                  name
                  id
                  level
                  ... on Prinsipper {
                    beskrivelse
                    prinsipp
                    level
                    id
                  }
                  ... on Retningslinjer {
                    beskrivelse
                    id
                    vurdering
                    level
                  }
                  ... on Suksesskriterium {
                    beskrivelse
                    id
                    vurdering
                    funn
                    level
    
                  }
                   ... on TestbareKriterier {
                    beskrivelse
                    id
                    vurdering
                    funn
                    level
                  }
                }
              }
            }
          }
    
  • Lindow 154 posts 1301 karma points
    Jul 29, 2023 @ 00:12
    Lindow
    0

    Hey Andreas

    Have you tried testing if the allContent>orderBy argument would suit your use case better?

    Also, for this kind of inquires, I recommend that you open a support ticket, so that the team can get access to your backoffice and help you out that way, as seeing your content and being able to query it directly would help a lot :)

  • Andreas Jacobsen 9 posts 60 karma points
    Aug 11, 2023 @ 16:30
    Andreas Jacobsen
    0

    Sorry for the late reply, summer holidays came along 🌴 We are still on the Heartcore mini-plan and as such do not have access to Umbraco email support.

    What do you mean when you say "allContent>orderBy", ordered by what? Can I somehow order by "allContent"?

    My goal is for the structure that is shown in the CMS to be the same as the structure I get in my GraphQL-query.

  • Lindow 154 posts 1301 karma points
    Aug 14, 2023 @ 06:30
    Lindow
    0

    Hey, you do have support.

    Heartcore is a SaaS product and as per - https://umbraco.com/products/umbraco-heartcore/pricing/ - you can reach out in the chat.

    I, also, recommend that you ask for Nicole : )

    Before then, it would be a good idea to check the "docs" tab in the GraphQL playground, as it shows you all possible arguments etc.

    I would have shown you a screenshot but I don't work at the company anymore, so I don't have access to a Heartcore project.

Please Sign in or register to post replies

Write your reply to:

Draft