Gridsome - "category not defined on the instance but referenced during render"

Viewed 168

I am using the Gridsome blog starter, and I am trying to add a categories list above the posts:

Below is the query. While it works as expected on the /__explore, on the app itself, I am getting the error: vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "category" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option or for class-based components, by initializing the property.

<page-query>
{
  metadata {
    sanityOptions {
      projectId
      dataset
    }
  }
  posts: allSanityPost(sortBy: "publishedAt") {
    edges {
      node {
        id
        title
        slug {
          current
        }
        categories {
          id
          title
        }
        publishedAt(format: "D. MMMM YYYY")
        _rawExcerpt
        mainImage {
          asset {
            _id
            url
          }
          caption
          alt
          hotspot {
            x
            y
            height
            width
          }
          crop {
            top
            bottom
            left
            right
          }
        }
      }
    }
  }
  categories: allSanityCategory(sortBy: "publishedAt") {
    edges {
      node {
        id
        title
      }
    }
  }

With that error, It still displays, two categories, as expected, when I just fill it with "a", instead of {{category.title}}

Thanks for your help. Avi.

0 Answers
Related