Reputation: 63
Alright guys am new to graphql and am having this weird behavior in my gatsby app. Am using strapi as backend and making a static query from gatsby.
const data = useStaticQuery(graphql`
query MyQuery {
allStrapiCategory {
edges {
node {
name
strapiId
}
}
}
}
`)
The above query works fine when query name is set to 'MyQuery'. But when I change query name to 'GetCategories' it gives me a error saying
Error in function useStaticQuery in ./.cache/gatsby-browser-entry.js:77
The result of this StaticQuery could not be fetched. This is likely a bug in Gatsby and if refreshing the page does not fix it, please open an issue in https://github.com/gatsbyjs/gatsby/issues
I like to set custom query name so it describes what it is fetching from backend.
Upvotes: 0
Views: 354
Reputation: 29320
It looks like you haven't stopped the development server when you changed the query name. In addition, the fact that is complaining about /cache
folder is weird.
Error in function useStaticQuery in ./.cache/gatsby-browser-entry.js:77
Try stopping the gatsby develop
command, change the query name, clear the cache by running gatsby clean
and run the gatsby develop
again.
Upvotes: 1