diff --git a/packages/gatsby/src/redux/actions/public.js b/packages/gatsby/src/redux/actions/public.js index b85eb7faab630..c69e8a8ba6ae8 100644 --- a/packages/gatsby/src/redux/actions/public.js +++ b/packages/gatsby/src/redux/actions/public.js @@ -798,6 +798,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 @@ -819,7 +821,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) }