Skip to content
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

Merged
merged 2 commits into from
Jan 2, 2019
Merged

docs(gatsby): improve createPages example #10777

merged 2 commits into from
Jan 2, 2019

Conversation

KyleAMathews
Copy link
Contributor

No description provided.

@KyleAMathews KyleAMathews requested a review from a team as a code owner January 2, 2019 18:47
Copy link
Contributor

@DSchau DSchau left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* reject(result.errors)
* return Promise.reject(result.errors)

Copy link
Contributor Author

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(`
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@DSchau DSchau changed the title Improve createPages example docs(gatsby): improve createPages example Jan 2, 2019
@KyleAMathews
Copy link
Contributor Author

This is a similar change to @pobch's in #10357

Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 Thanks!

@DSchau DSchau merged commit 060661f into master Jan 2, 2019
@KyleAMathews KyleAMathews deleted the create-pages-api branch January 2, 2019 19:23
DSchau pushed a commit that referenced this pull request Jan 2, 2019
## Description
Remove extra promise in `starters/blog/gatsby-node.js`.

## Related Issues
The same fixes is made for these pull requests.

#10357
#10777
gatsbybot pushed a commit to gatsbyjs/gatsby-starter-blog that referenced this pull request Jan 2, 2019
## 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
@KyleAMathews
Copy link
Contributor Author

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

gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
<!--
  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.
-->
gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
## 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
ish-xyz pushed a commit to ish-xyz/ish-ar.io that referenced this pull request Dec 5, 2019
## 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
leonhiat added a commit to leonhiat/gatsby-starter-blog that referenced this pull request Oct 31, 2023
## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants