travis-r6s / gridsome-source-shopify

Shopify source plugin for Gridsome
https://gridsome-shopify-starter.netlify.com
MIT License
16 stars 14 forks source link

Trying to get comments in allShopifyArticle #69

Closed antero10 closed 3 years ago

antero10 commented 3 years ago

Hello, I'm trying to get comments in allShopifyArticle query and it show that attribute is not available, what could be the problem?

Here is my query

query Publications {
  allShopifyArticle {
    edges {
      node {
        handle
        id
        image {
          originalSrc
        }
        seo {
          description
        }
        comments(first: 10) {
          edges {
            cursor
            node {
              author {
                email
              }
              content
            }
          }
        }
        title
        publishedAt

      }
    }
    totalCount
  }
}

Here is my error

{
  "error": {
    "errors": [
      {
        "message": "Cannot query field \"comments\" on type \"ShopifyArticle\". Did you mean \"content\"?",
        "stringified": "Cannot query field \"comments\" on type \"ShopifyArticle\". Did you mean \"content\"?\n\nGraphQL request:13:9\n12 |         }\n13 |         comments(first: 10) {\n   |         ^\n14 |           edges {"
      }
    ]
  }
}

I'm not sure what could be the problem. Please some help

travis-r6s commented 3 years ago

I just haven't added the comments field to the query, as I didn't think there would be much use for it - if you did fetch the comments in that query then it would only show the comments from when the site was last built, so it wouldn't always be up-to-date. It would usually make more sense to fetch the comments client-side, so you are always getting the latest comments.

antero10 commented 3 years ago

Makes sense