-
Notifications
You must be signed in to change notification settings - Fork 1
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
FIX post thumbnail type (String -> File) #5
Conversation
This pull request introduces 19 alerts and fixes 21 when merging 9a27f41 into 6661f86 - view on LGTM.com new alerts:
fixed alerts:
|
@@ -149,7 +149,7 @@ export const createSchemaCustomization: GatsbyNode['createSchemaCustomization'] | |||
rawContent: 'String!', | |||
shortDescription: 'String!', | |||
thumbnail: { | |||
type: 'String', | |||
type: 'File', |
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.
This is actually not the proper type for the source plugin. because the only thing I can get from the API surface is a string or URL.
You can derive it on your site node, or transformer as you need.
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.
However, thumbnails of VelogUser
, VelogTag
, and VelogSeries
types are File type. Not only that, as you can see that createRemoteFileNode.id
is assigned to post.thumbnail
, this seems close to the original intention.
if (post.thumbnail) {
const thumbnailNode = await createRemoteFileNode({
url: post.thumbnail,
store,
cache,
reporter,
createNode,
createNodeId,
});
postSource.thumbnail = thumbnailNode.id;
} else {
delete postSource['thumbnail'];
}
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.
Ah you right. I totally forgot I intented ease of use on this plugin. Maybe I should refactor those types 🤔
VelogPost.thumbnail
fromString
toFile
.createRemoteFileNode
arguments (fix(gatsby-source-filesystem): UpdatecreateRemoteFileNode
args gatsbyjs/gatsby#35422)