-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(gatsby): improve createPages example #10777
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments! Thank you :)
* } | ||
* `).then(result => { | ||
* if (result.errors) { | ||
* reject(result.errors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* reject(result.errors) | |
* return Promise.reject(result.errors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh this should be a throw
, yikes, didn't read this very closely.
* // Query for markdown nodes to use in creating pages. | ||
* // You can query for whatever data you want to create pages for e.g. | ||
* // products, portfolio items, landing pages, etc. | ||
* graphql(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to return here? It doesn't really matter either way, but it doesn't hurt
* ) | ||
* }) | ||
* | ||
* return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably just drop this? The flow ends here anyways, particularly if we return the graphql
call above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 Thanks!
## Description Remove extra promise in `starters/blog/gatsby-node.js`. ## Related Issues The same fixes is made for these pull requests. gatsbyjs/gatsby#10357 gatsbyjs/gatsby#10777
Hmm now that I think about it, in the past I've avoided throwing because that meant you couldn't get to graphiql to try fixing the error. I wonder if we should automatically catch graphql errors internally and show a nice clean error with a link to open the query as is in graphiql and never return graphql errors. /cc @gatsbyjs/core |
<!-- Have any questions? Check out the contributing docs at https://gatsby.app/contribute, or ask in this Pull Request and a Gatsby maintainer will be happy to help :) --> <!-- Write a brief description of the changes introduced by this PR --> <!-- Link to the issue that is fixed by this PR (if there is one) e.g. Fixes gatsbyjs#1234, Addresses gatsbyjs#1234, Related to gatsbyjs#1234, etc. -->
## Description Remove extra promise in `starters/blog/gatsby-node.js`. ## Related Issues The same fixes is made for these pull requests. gatsbyjs#10357 gatsbyjs#10777
## Description Remove extra promise in `starters/blog/gatsby-node.js`. ## Related Issues The same fixes is made for these pull requests. gatsbyjs/gatsby#10357 gatsbyjs/gatsby#10777
## Description Remove extra promise in `starters/blog/gatsby-node.js`. ## Related Issues The same fixes is made for these pull requests. gatsbyjs/gatsby#10357 gatsbyjs/gatsby#10777
No description provided.