fix: don't add gatsby internals to resolved reference gatsby nodes #147
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thecounter
property in theinternal
object, sourced by thegatsby-source-sanity
plugin: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