Skip to content

Commit

Permalink
fix: don't print deprecation warning for touchNode for the sample plu…
Browse files Browse the repository at this point in the history
…gin multiple times (#29745)
  • Loading branch information
pieh committed Feb 25, 2021
1 parent 66477f1 commit d024b70
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/gatsby/src/redux/actions/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,8 @@ actions.createNode = (...args) => dispatch => {
})
}

const touchNodeDeprecationWarningDisplayedMessages = new Set()

/**
* "Touch" a node. Tells Gatsby a node still exists and shouldn't
* be garbage collected. Primarily useful for source plugins fetching
Expand All @@ -824,7 +826,10 @@ actions.touchNode = (node: any, plugin?: Plugin) => {
msg = msg + ` "touchNode" was called by ${plugin.name}`
}

report.warn(msg)
if (!touchNodeDeprecationWarningDisplayedMessages.has(msg)) {
report.warn(msg)
touchNodeDeprecationWarningDisplayedMessages.add(msg)
}

node = getNode(node.nodeId)
}
Expand Down

0 comments on commit d024b70

Please sign in to comment.