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: fix the lost of external file node after rebuilding #22528

Merged
merged 4 commits into from
Mar 24, 2020

Conversation

StinsonZhao
Copy link
Contributor

@StinsonZhao StinsonZhao commented Mar 24, 2020

Description

After adding this, someone can modify *.md, then the rebuilding by 'gatsby develop' will not break the type inference for a foreign-key field created by the plugin.

Related Issues

Fix #22127

…lding

After adding this, someone can modify `*.md`, then the rebuilding by 'gatsby develop' will not break the type inference for a foreign-key field created by the plugin.

Fix(gatsbyjs#22127): gatsbyjs#22127
@StinsonZhao StinsonZhao requested a review from a team as a code owner March 24, 2020 03:22
@laurieontech laurieontech added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Mar 24, 2020
@laurieontech
Copy link
Contributor

laurieontech commented Mar 24, 2020

Thanks for the PR! This is a really great change. Looking at the larger doc I'm thinking we should also make an update to item 1 in the going step by step through the code section. Namely,

Define some types for MarkdownRemark using the Schema Customization API. For `featuredImg`, [point the link extension to the correct name](https://www.gatsbyjs.org/docs/preprocessing-external-images/). Defining a field for alternative text as `featuredImgAlt` can also improve accessibility, in addition to providing context for the image if it fails to load.

Would that have helped you when you ran into the problem? Open to suggestions.

@StinsonZhao
Copy link
Contributor Author

Thanks for the PR! This is a really great change. Looking at the larger doc I'm thinking we should also make an update to item 1 in the going step by step through the code section. Namely,

Define some types for MarkdownRemark using the Schema Customization API. For `featuredImg`, [point the link extension to the correct name](https://www.gatsbyjs.org/docs/preprocessing-external-images/). Defining a field for alternative text as `featuredImgAlt` can also improve accessibility, in addition to providing context for the image if it fails to load.

Would that have helped you when you ran into the problem? Open to suggestions.

How about this change for item 1:

Define some types for MarkdownRemark using the Schema Customization API. For featuredImg, use the from argument to point the link extension to the correct field name(with a ___NODE suffix), more details about foreign-key fields here. Defining a field for alternative text as featuredImgAlt can also improve accessibility, in addition to providing context for the image if it fails to load.

@laurieontech
Copy link
Contributor

That looks great!

@@ -85,7 +85,7 @@ exports.onCreateNode = async ({

Going step by step through the code:

1. Define some types for `MarkdownRemark` using the Schema Customization API. Defining a field for alternative text as `featuredImgAlt` can also improve accessibility, in addition to providing context for the image if it fails to load.
1. Define some types for MarkdownRemark using the Schema Customization API. For `featuredImg`, use the `from` argument to point the `link` extension to the correct field name(with a `___NODE` suffix), [more details about foreign-key fields here](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields). Defining a field for alternative text as `featuredImgAlt` can also improve accessibility, in addition to providing context for the image if it fails to load.
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
1. Define some types for MarkdownRemark using the Schema Customization API. For `featuredImg`, use the `from` argument to point the `link` extension to the correct field name(with a `___NODE` suffix), [more details about foreign-key fields here](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields). Defining a field for alternative text as `featuredImgAlt` can also improve accessibility, in addition to providing context for the image if it fails to load.
1. Define some types for MarkdownRemark using the Schema Customization API. For `featuredImg`, use the `from` argument to point the `link` extension to the correct field name (with a `___NODE` suffix), [more details about foreign-key fields here](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields). Defining a field for alternative text as `featuredImgAlt` can also improve accessibility, in addition to providing context for the image if it fails to load.

@laurieontech
Copy link
Contributor

This is great! Thanks so much for tracking down the solution elsewhere in the docs and making this change to help future users :)

@StinsonZhao
Copy link
Contributor Author

That is so kind of you. Thank you.

It's a snap to me. I'll be happy if it can really help anyone else.

@laurieontech laurieontech merged commit eb3fb20 into gatsbyjs:master Mar 24, 2020
@gatsbot
Copy link

gatsbot bot commented Mar 24, 2020

Holy buckets, @StinsonZhao — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. We’ve got Gatsby t-shirts, stickers, hats, scrunchies, and much more. (You can also unlock even more free swag with 5 contributions — wink wink nudge nudge.) See gatsby.dev/swag for details.
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

file node (created by createRemoteFileNode) lost after rebuilding during 'gatsby develop'
2 participants