Skip to content

V2 - Internal GraphQL refactor

Latest
Compare
Choose a tag to compare
@travis-r6s travis-r6s released this 13 May 22:45
· 10 commits to main since this release
6819d78

TLDR: While this release has had some fairly major internal refactoring, no major user functionality has really changed. Please note that path is no longer automatically available in your search result.

Internal update to use GraphQL

The code has been changed to use Gridsome's internal graphql function - this brings a number of benefits, including automatically resolving & fetching referenced data, local (built) image paths, and using the internal schema so any custom resolvers are picked up.

Deprecations

As the plugin now uses the internal graphql function, no node fields will be automatically added to your search result. This means that the path field (which was automatically added if available in version 1) will need to be specifically added to your collection fields.

collections: [
  {
    typeName: "post",
    indexName: "post",
+   fields: ["title", "description", "heroImage", "path"],
  },
]

You can access it in the search result as with any other field: <g-link :to="searchResult.node.path"></g-link>

This release drops support for fetching data from remote schemas. The main reason for this being that you probably shouldn't use them anyway 🙃 - it brings quite a few difficulties that Gridsome's internals are meant to solve - for example, if you wanted to use this with WP GraphQL, it would be too complicated for this plugin to sort GraphQL pagination, so you would only ever get the first 100 results from any custom query.