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

FIX post thumbnail type (String -> File) #5

Closed
wants to merge 5 commits into from

Conversation

wickedev
Copy link
Contributor

@wickedev wickedev commented Nov 5, 2022

@lgtm-com
Copy link

lgtm-com bot commented Nov 5, 2022

This pull request introduces 19 alerts and fixes 21 when merging 9a27f41 into 6661f86 - view on LGTM.com

new alerts:

  • 13 for Expression has no effect
  • 4 for Useless conditional
  • 1 for Useless assignment to local variable
  • 1 for Unneeded defensive code

fixed alerts:

  • 13 for Unused variable, import, function or class
  • 8 for Useless assignment to local variable

@@ -149,7 +149,7 @@ export const createSchemaCustomization: GatsbyNode['createSchemaCustomization']
rawContent: 'String!',
shortDescription: 'String!',
thumbnail: {
type: 'String',
type: 'File',
Copy link
Owner

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.

Copy link
Contributor Author

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'];
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Additionally, thumbnail of String is returning null.

image

Copy link
Owner

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 🤔

@cometkim cometkim closed this Nov 7, 2022
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.

None yet

2 participants