Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't print deprecation warning for touchNode for the sample plugin multiple times #29745

Merged
merged 2 commits into from
Feb 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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
Expand All @@ -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)
}
Expand Down