Skip to content

fix: don't add gatsby internals to resolved reference gatsby nodes #147

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

Merged

Conversation

AdamDemirel
Copy link
Contributor

@AdamDemirel AdamDemirel commented Mar 2, 2022

This PR resolves issues which occurs for Incremental Builds in Gatsby, when using the plugin.

The way that the Incremental Builds feature works is that it marks routes (HTML files + JSON page data) for regeneration if any of the following inputs change: https://www.gatsbyjs.com/docs/debugging-incremental-builds/#how-does-it-work

Our team experienced an issue where files were getting marked for regeneration on every build, even with no frontend code changing, or updates in the CMS.

The result of diffing between builds showed that the page-data/*.json files being outputted by the gatsby build had a changing value for the counter property in the internal object, sourced by the gatsby-source-sanity plugin:
image

This is a bug, since the counter result is changed between builds and these internals don't need to be exposed for node creation - they are used by Gatsby internally for tracking performance, and tests etc.

This small commit simply filters out those internals from getting added to the node to prevent the counter value changing to cause the pages to be marked for rebuild.

Here's a TS REPL demoing that the property gets dropped as expected with the change introduced in this commit

@dotcollective-support
Copy link

Bump to get some attention on this...

@evenwestvang
Copy link
Member

Thank you for submitting and bumping. We'll have a look.

@stipsan
Copy link
Member

stipsan commented Mar 31, 2022

Great fix @dotdev-support! Merging and releasing in a few minutes 😄

@stipsan
Copy link
Member

stipsan commented Mar 31, 2022

Gonna merge, will fix failing tests post merge 👍

@stipsan stipsan merged commit c29f23a into sanity-io:main Mar 31, 2022
@stipsan
Copy link
Member

stipsan commented Mar 31, 2022

Released under v7.4.1 🎉

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.

4 participants