Closed duranmla closed 3 years ago
This would be done when you actually set up the graphql query on the page, something like:
allAbouts( filter: { user_count: { eq: 33000 } } ) {
edges {
node {
user_count
}
}
}
But that doesn't quite solve the issue, isn't? So imagine you're starting to build the site and the server is down (the most easy to describe case will be to do yarn start
on Gatsby site locally without starting the server) This will thrown error like:
As the query indeed is not there (notice how I toggle between the GraphiQL when the server with the api is running and when the server with the api is not running in my local) allAbout is not created when the server is not available in build time
And there is a lot going on at https://www.gatsbyjs.com/docs/schema-customization/#creating-type-definitions so I was wondering about a built-in option from gatsby-source-custom-api
to tackle this scenario
Ah I see what you mean, misunderstood your question I thought you were trying to filter your query. This seems to be a common issue with Gatsby. Read through this issue (https://github.com/gatsbyjs/gatsby/issues/2392), there are a few proposed solutions in there (creating a resolver in gatsby-node)
Got it, I will need to test this out if worth the trouble but in the mean time I would close the issue...Thanks for the replies!!
Hi!
In order to avoid more complexity at the development time and maybe crashes at building time due to the possibility of a server not being running can we add default values on a given schema? For instance I have:
Which I would like to say something like:
It feels a bit overkill that the entire page crashes cause the server is not available. Any thoughts? Thanks a lot for this solution btw, really appreciate the work have been done here!