How Queries Work
We’re talking about GraphQL queries here. These can be tagged graphql expressions at the bottom of your component source file (e.g query for Gatsby frontpage), StaticQueries within your components (e.g showcase site details), or fragments created by plugins (e.g gatsby-source-contentful).
Note that we are NOT talking about queries involved in the creation of your pages, which is usually performed in your site’s gatsby-node.js (e.g Gatsby’s website). We’re only talking about queries that are tied to particular pages or templates.
Almost all logic to do with queries is in the internal-plugin query-runner. There are two steps involved in a Query’s life time. The first is extracting it, and the second is running it. These are separated into two bootstrap phases.
edit this page on GitHub