Skip to content

Commit d024b70

Browse files
authored
fix: don't print deprecation warning for touchNode for the sample plugin multiple times (#29745)
1 parent 66477f1 commit d024b70

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/gatsby/src/redux/actions/public.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,8 @@ actions.createNode = (...args) => dispatch => {
803803
})
804804
}
805805

806+
const touchNodeDeprecationWarningDisplayedMessages = new Set()
807+
806808
/**
807809
* "Touch" a node. Tells Gatsby a node still exists and shouldn't
808810
* be garbage collected. Primarily useful for source plugins fetching
@@ -824,7 +826,10 @@ actions.touchNode = (node: any, plugin?: Plugin) => {
824826
msg = msg + ` "touchNode" was called by ${plugin.name}`
825827
}
826828

827-
report.warn(msg)
829+
if (!touchNodeDeprecationWarningDisplayedMessages.has(msg)) {
830+
report.warn(msg)
831+
touchNodeDeprecationWarningDisplayedMessages.add(msg)
832+
}
828833

829834
node = getNode(node.nodeId)
830835
}

0 commit comments

Comments
 (0)