algolia / gatsby-plugin-algolia

A plugin to push to Algolia based on graphQl queries
https://yarn.pm/gatsby-plugin-algolia
Apache License 2.0
178 stars 45 forks source link

docs(query): make sure people use the right name #10

Closed Haroenv closed 6 years ago

Haroenv commented 6 years ago

fixes #6

  1. makes documentation clearer and less likely to make the error of not providing a query
  2. rethrow errors of graphql
  3. throw an error if there's no query
ErisDS commented 6 years ago

I don't know if it's useful so feel free to ignore, but during my hunt for a reason why my code wasn't working earlier 😳 I spotted this pattern used in some of the gatsby core plugins, where they have a runQuery tool to handle errors.

Note: links from 2 different plugins: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-sitemap/src/gatsby-node.js#L23 https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-feed/src/internals.js#L6

ErisDS commented 6 years ago

P.S. Have tested these changes locally and they appear to work well - it just called me out on an issue with my query, which was very useful 👍

Haroenv commented 6 years ago

Thanks Hannah, since it’s still in beta I would still be able to rename that, looks like a nice pattern