You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem to run Gatsby when there is a field in graphql that is empty (in cms sometimes the field will be empty sometimes not). I managed to solve this problem by adding in gatsby-node.js via createTypes the missing content. Unfortunately just as for the text using the string type works fine so for the photo using the File type subfield localFile is not created. I need the localFile to appear even if there is no photo, the same way as photo is added. Does anyone have an idea how to solve this. Thanks a lot in advance for your help.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a problem to run Gatsby when there is a field in graphql that is empty (in cms sometimes the field will be empty sometimes not). I managed to solve this problem by adding in gatsby-node.js via createTypes the missing content. Unfortunately just as for the text using the string type works fine so for the photo using the File type subfield localFile is not created. I need the localFile to appear even if there is no photo, the same way as photo is added. Does anyone have an idea how to solve this. Thanks a lot in advance for your help.
gatsby-node.js
`exports.sourceNodes = ({ actions }) => {
const { createTypes } = actions
const typeDefs = ` type StrapiPageEstimateRealizations implements Node {
Title: String
Description: String
Img: File
}
createTypes(typeDefs) }graphql when the photo field is empty

graphql when a picture is added in cms

Beta Was this translation helpful? Give feedback.
All reactions