Skip to content

Commit 7fc3674

Browse files
committed
Fix tracking nodes with filtering/running sift. Before we filter nodes we create copies of nodes with appended fields added by plugins (by setFieldsOnGraphQLNodeType) if they are filtered on. These copies weren't tracked.
1 parent 73abe7f commit 7fc3674

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/gatsby/src/redux/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const trackInlineObjectsInRootNode = node => {
4848
}
4949
addRootNodeToInlineObject(v, node.id)
5050
})
51+
return node
5152
}
5253
exports.trackInlineObjectsInRootNode = trackInlineObjectsInRootNode
5354

packages/gatsby/src/schema/run-sift.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { connectionFromArray } = require(`graphql-skip-limit`)
55
const { createPageDependency } = require(`../redux/actions/add-page-dependency`)
66
const prepareRegex = require(`./prepare-regex`)
77
const Promise = require(`bluebird`)
8+
const { trackInlineObjectsInRootNode } = require(`../redux`)
89

910
function awaitSiftField(fields, node, k) {
1011
const field = fields[k]
@@ -109,6 +110,7 @@ module.exports = ({
109110
return Promise.all(
110111
nodes.map(node => resolveRecursive(node, fieldsToSift, type.getFields()))
111112
).then(myNodes => {
113+
myNodes = myNodes.map(trackInlineObjectsInRootNode)
112114
if (!connection) {
113115
const index = _.isEmpty(siftArgs)
114116
? 0

0 commit comments

Comments
 (0)