Skip to content

Commit

Permalink
fix(gatsby): rewrite a spread that would break at scale (#28910)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdz authored Jan 8, 2021
1 parent c362463 commit 638ac0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/gatsby/src/schema/node-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ class LocalNodeModel {
result = getNodes()
} else {
const nodeTypeNames = toNodeTypeNames(this.schema, type)
const nodes = nodeTypeNames.reduce((acc, typeName) => {
acc.push(...getNodesByType(typeName))
return acc
}, [])
const nodesByType = nodeTypeNames.map(typeName =>
getNodesByType(typeName)
)
const nodes = [].concat(...nodesByType)
result = nodes.filter(Boolean)
}

Expand Down

0 comments on commit 638ac0a

Please sign in to comment.