Skip to content

Commit

Permalink
perf(gatsby): more efficient parent-child check through arrays (#22126)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdz authored Mar 10, 2020
1 parent 5f02fd0 commit be7111b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/gatsby/src/redux/actions/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,9 +1034,9 @@ actions.createParentChildLink = (
{ parent, child }: { parent: any, child: any },
plugin?: Plugin
) => {
// Update parent
parent.children.push(child.id)
parent.children = _.uniq(parent.children)
if (!parent.children.includes(child.id)) {
parent.children.push(child.id)
}

return {
type: `ADD_CHILD_NODE_TO_PARENT_NODE`,
Expand Down

0 comments on commit be7111b

Please sign in to comment.