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(gatsby-remark-images): fix unresolved promise #30418

Merged
merged 1 commit into from
Mar 23, 2021
Merged

Conversation

wardpeet
Copy link
Contributor

Description

Fixes a unresolved promise which stalls the sourceNodes call

Documentation

Related Issues

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Mar 23, 2021
@LekoArts LekoArts added topic: remark/mdx Related to Markdown, remark & MDX ecosystem and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Mar 23, 2021
Copy link
Contributor

@vladar vladar left a comment

Choose a reason for hiding this comment

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

This will resolve even if there is no rawHTML. What if calling code always expects type and value for resolved nodes? Maybe we need to reject instead when there is no HTML?

@wardpeet
Copy link
Contributor Author

if (
isRelativeUrl(node.url) &&
fileType !== `gif` &&
fileType !== `svg`
) {
const rawHTML = await generateImagesAndUpdateNode(
node,
resolve,
inLink,
overWrites
)
if (rawHTML) {
// Replace the image or ref node with an inline HTML node.
if (refNode) {
node = refNode
}
node.type = `html`
node.value = rawHTML
}
return resolve(node)

Is what we previously had. I didn't really look into the code besides that

@wardpeet wardpeet merged commit c240813 into master Mar 23, 2021
@wardpeet wardpeet deleted the chore/remark-images branch March 23, 2021 14:48
wardpeet added a commit that referenced this pull request Mar 23, 2021
wardpeet added a commit that referenced this pull request Mar 23, 2021
(cherry picked from commit c240813)

Co-authored-by: Ward Peeters <ward@coding-tech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: remark/mdx Related to Markdown, remark & MDX ecosystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants