enhance(bcd): Remove redundant getCurrentSupport() #10140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes the
getCurrentSupport()
helper function from the BCD renderer.Warning: requires a PR to land inbcd-utils
to function: mdn/bcd-utils#29Problem
About a year ago, a change landed in BCD to automatically order the support statements in a way that is nearly identical to how
getCurrentSupport()
searches through statements. It is redundant to define this function, since it would mean we're duplicating work.Solution
Since it is redundant to perform work twice, the solution is simple: just remove the function, and get the first statement in the array that BCD sorts.
How did you test this change?
I spent a LOT of time unlinking Yari from
@mdn/bcd-utils-api
(see #10186). Some things were still broken (they've been fixed since due to updates to BCD), I confirmed it was picking the correct statement:developer.mozilla.org (history open to show the statements it is choosing from):
local: