Skip to content

Commit 638ac0a

Browse files
authored
fix(gatsby): rewrite a spread that would break at scale (#28910)
1 parent c362463 commit 638ac0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/gatsby/src/schema/node-model.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ class LocalNodeModel {
199199
result = getNodes()
200200
} else {
201201
const nodeTypeNames = toNodeTypeNames(this.schema, type)
202-
const nodes = nodeTypeNames.reduce((acc, typeName) => {
203-
acc.push(...getNodesByType(typeName))
204-
return acc
205-
}, [])
202+
const nodesByType = nodeTypeNames.map(typeName =>
203+
getNodesByType(typeName)
204+
)
205+
const nodes = [].concat(...nodesByType)
206206
result = nodes.filter(Boolean)
207207
}
208208

0 commit comments

Comments
 (0)