You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(gatsby): Exclude the internal/fields objects for greater consistency creating contentDigest (#33671)
* feat(gatsby-core-utils): Exclude the internal object for greater consistency
I was puzzled why a site was having more nodes than expected by marked as changed on each data update. I use jest-diff to show the diff between the nodes and as it turns out, it was all trivial differences in the `internal` object. Since the `internal` object is managed by the framework and source/transformer plugins typically don't ensure that the `internal` object hasn't changed between updates — we should just exclude it when generating the digest.
Making this change resulted in ~20 less nodes being changed which reduced the number of invalidated queries from ~40k to ~6k, dramatically speeding up the incremental builds.
I tested whether the destructuring would slow things down any by running the ~700k nodes on this site through both the old and new version of the site. They were essentially the same — ~16.5s vs. ~16.9s with the new algorithm being faster, presumably as we don't now have to hash the internal object.
I expect this will result in fewer changed nodes in a lot of plugins.
* Update create-content-digest.ts
* Only hash as node if node & update snapshots
* Only remove autogenerated fields from internal object
* Move node-specific createContentDigest code to api-runner-node
* revert snapshot changes
* update snapshots
* Update packages/gatsby/src/utils/api-runner-node.js
Co-authored-by: Michal Piechowiak <[email protected]>
Co-authored-by: Ward Peeters <[email protected]>
Co-authored-by: Michal Piechowiak <[email protected]>
Copy file name to clipboardExpand all lines: integration-tests/cache-resilience/plugins/source-and-transformers-child-nodes/transformer-added/scenario.js
Copy file name to clipboardExpand all lines: integration-tests/cache-resilience/plugins/source-and-transformers-child-nodes/transformer-changed/scenario.js
Copy file name to clipboardExpand all lines: integration-tests/cache-resilience/plugins/source-and-transformers-child-nodes/transformer-removed/scenario.js
Copy file name to clipboardExpand all lines: integration-tests/cache-resilience/plugins/source-and-transformers-node-fields/transformer-added/scenario.js
Copy file name to clipboardExpand all lines: integration-tests/cache-resilience/plugins/source-and-transformers-node-fields/transformer-changed/scenario.js
0 commit comments