-
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
file node (created by createRemoteFileNode) lost after rebuilding during 'gatsby develop' #22127
Comments
And if I use exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions
createTypes(`
type MarkdownRemark implements Node {
frontmatter: Frontmatter
illustration: File
}
type Frontmatter {
title: String!
illustration: String
}
`)
} The error will disappear, but I still can not get the illustration. I will get illustration is |
😝 I got it. In this doc: https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields
So, I followed this and modified the exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions
createTypes(`
type MarkdownRemark implements Node {
frontmatter: Frontmatter
- illustration: File
+ illustration: File @link(from: "illustration___NODE")
}
type Frontmatter {
title: String
illustration: String
}
`)
} Then the problem was solved. I think this doc Preprocessing External Images should be updated. |
We'd gladly accept a PR from you fixing the docs! :) |
…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
* docs: fix the lost of external file node after 'gatsby develop' rebuilding 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(#22127): #22127 * amend: update the explanation in step one * Update preprocessing-external-images.md * Update docs/docs/preprocessing-external-images.md Co-authored-by: LB <[email protected]>
* docs: fix the lost of external file node after 'gatsby develop' rebuilding 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(#22127): gatsbyjs/gatsby#22127 * amend: update the explanation in step one * Update preprocessing-external-images.md * Update docs/docs/preprocessing-external-images.md Co-authored-by: LB <[email protected]>
* docs: fix the lost of external file node after 'gatsby develop' rebuilding 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(#22127): gatsbyjs/gatsby#22127 * amend: update the explanation in step one * Update preprocessing-external-images.md * Update docs/docs/preprocessing-external-images.md Co-authored-by: LB <[email protected]>
Description
I use
createRemoteFileNode
for Preprocessing External Images, and I follow this document: https://www.gatsbyjs.org/docs/preprocessing-external-images/Everything is OK. But during developing, I found that the 'file node' would be missing if I removed some pictures in
*.md
Steps to reproduce
I use the gatsby-starter-blog for reproducing it.
gatsby new gatsby-starter-blog https://github.com/gatsbyjs/gatsby-starter-blog
modify a post(
*.md
) with aillustration
frontmatter// content/blog/hello-world/index.md --- title: Hello World date: "2015-05-01T22:12:03.284Z" description: "Hello World" + illustration: https://image.freepik.com/free-photo/scottish-fold-cat-blue-surface_23-2148181678.jpg ---
gatsby-node.js
, usecreateRemoteFileNode
blog-post.js
, add illustration before the whole article.yarn run develop
. Everything is OKModify something in markdown, maybe delete some words, then
cmd+s
to saveGatsby will rebuild and live reload by itself, and an error is thrown. And in GraphiQL, I can not get the
illustration
nodegatsby develop
. And once I changed the pictures in.md
, I have to re-rungatsby develop
, that's annoying.Expected result
No error. I can develop with remote images normally
Actual result
Error happened.
Environment
The text was updated successfully, but these errors were encountered: