Skip to content

Commit

Permalink
BCD: Current support may not be most recent support item
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhjacobs committed Apr 10, 2022
1 parent ebc05a2 commit 8bfa2b5
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ function getSupportClassName(
className = "preview";
} else if (version_added) {
className = "yes";
if (version_removed || (flags && flags.length)) {
if (
(version_removed &&
!asList(support!).some((item) =>
isFullySupportedWithoutLimitation(item)
)) ||
(flags && flags.length)
) {
className = "no";
}
} else {
Expand Down Expand Up @@ -136,12 +142,17 @@ const CellText = React.memo(
support: bcd.SupportStatement | undefined;
browser: bcd.BrowserStatement;
}) => {
const currentSupport = getFirst(support);
const currentSupport =
(support &&
asList(support).find((item) =>
isFullySupportedWithoutLimitation(item)
)) ??
getFirst(support);

const added = currentSupport?.version_added ?? null;
const removed = currentSupport?.version_removed ?? null;

const browserReleaseDate = getSupportBrowserReleaseDate(support);
const browserReleaseDate = getSupportBrowserReleaseDate(currentSupport);

let status:
| { isSupported: "unknown" }
Expand Down Expand Up @@ -183,7 +194,11 @@ const CellText = React.memo(
break;
}

if (removed) {
if (
removed &&
support &&
!asList(support).some((item) => isFullySupportedWithoutLimitation(item))
) {
status = {
isSupported: "no",
label: (
Expand Down

0 comments on commit 8bfa2b5

Please sign in to comment.