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): Fix missing fragment definition #21081

Closed
wants to merge 1 commit into from

Conversation

sidharthachatterjee
Copy link
Contributor

@sidharthachatterjee sidharthachatterjee commented Jan 31, 2020

It looks like some Fragment definitions were missing due to the code path in

if (cachedUsedFragments) {

This is a hot fix which adds a check for the size of the Set

Fixes #20984

@sidharthachatterjee sidharthachatterjee requested a review from a team as a code owner January 31, 2020 11:55
@@ -435,7 +435,9 @@ const determineUsedFragmentsForDefinition = (
) => {
const { def, name, isFragment, filePath } = definition
const cachedUsedFragments = fragmentsUsedByFragment.get(name)
if (cachedUsedFragments) {

// `cachedUsedFragments` could be a Set with size 0 which happens to be truthy
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that Set with 0 size can be correct (i.e. when fragment doesn't actually use other fragments).

The problem here is sometimes it's 0 when it shouldn't be

So this adds additional works sometimes, but it's easiest hot fix we can come up without diving too much into this code, which will require @vladar expertise most likely

@sidharthachatterjee
Copy link
Contributor Author

We've published a canary in gatsby@2.19.11-issue-20984

@vladar
Copy link
Contributor

vladar commented Feb 1, 2020

Closing this in favor of the successor PR: #21128

@vladar vladar closed this Feb 1, 2020
@sidharthachatterjee sidharthachatterjee deleted the fix/fragment-caching branch February 1, 2020 20:23
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.

Gatsby Image - Unknown fragment ...
3 participants