Skip to content

Commit

Permalink
Fix tracking nodes with filtering/running sift. Before we filter node…
Browse files Browse the repository at this point in the history
…s we create copies of nodes with appended fields added by plugins (by setFieldsOnGraphQLNodeType) if they are filtered on. These copies weren't tracked.
  • Loading branch information
pieh committed Feb 13, 2018
1 parent 73abe7f commit 7fc3674
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/gatsby/src/redux/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const trackInlineObjectsInRootNode = node => {
}
addRootNodeToInlineObject(v, node.id)
})
return node
}
exports.trackInlineObjectsInRootNode = trackInlineObjectsInRootNode

Expand Down
2 changes: 2 additions & 0 deletions packages/gatsby/src/schema/run-sift.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { connectionFromArray } = require(`graphql-skip-limit`)
const { createPageDependency } = require(`../redux/actions/add-page-dependency`)
const prepareRegex = require(`./prepare-regex`)
const Promise = require(`bluebird`)
const { trackInlineObjectsInRootNode } = require(`../redux`)

function awaitSiftField(fields, node, k) {
const field = fields[k]
Expand Down Expand Up @@ -109,6 +110,7 @@ module.exports = ({
return Promise.all(
nodes.map(node => resolveRecursive(node, fieldsToSift, type.getFields()))
).then(myNodes => {
myNodes = myNodes.map(trackInlineObjectsInRootNode)
if (!connection) {
const index = _.isEmpty(siftArgs)
? 0
Expand Down

0 comments on commit 7fc3674

Please sign in to comment.