diff --git a/docusaurus/src/helpers/objects.js b/docusaurus/src/helpers/objects.js index 8f962047f851..98b07e2e4a41 100644 --- a/docusaurus/src/helpers/objects.js +++ b/docusaurus/src/helpers/objects.js @@ -101,7 +101,7 @@ const getFromPaths = (obj, path, defaultValue = undefined) => { // Try to get the value from each possible path for (let possiblePath of possiblePaths) { const value = get(obj, possiblePath); - if (value !== undefined) { + if (value !== undefined && value !== null) { return value; } } diff --git a/docusaurus/src/remark/docsHeaderDecoration.js b/docusaurus/src/remark/docsHeaderDecoration.js index c4c1d5401b09..4d1537b43d4e 100644 --- a/docusaurus/src/remark/docsHeaderDecoration.js +++ b/docusaurus/src/remark/docsHeaderDecoration.js @@ -43,17 +43,13 @@ const plugin = () => { const originalId = node.data.hProperties.id; const rawCDKVersion = getFromPaths(registryEntry, "packageInfo_[oss|cloud].cdk_version"); - const syncSuccessRate = getFromPaths(registryEntry, "generated_[oss|cloud].metrics.cloud.sync_success_rate"); + const syncSuccessRate = getFromPaths(registryEntry, "generated_[oss|cloud].metrics.[all|cloud|oss].sync_success_rate"); const usageRate = getFromPaths(registryEntry, "generated_[oss|cloud].metrics.[all|cloud|oss].usage"); const lastUpdated = getFromPaths(registryEntry, "generated_[oss|cloud].source_file_info.metadata_last_modified"); const {version, isLatest, url} = parseCDKVersion(rawCDKVersion, latestPythonCdkVersion); - firstHeading = false; - node.children = []; - node.type = "mdxJsxFlowElement"; - node.name = "HeaderDecoration"; - node.attributes = toAttributes({ + const attrDict = { isOss: registryEntry.is_oss, isCloud: registryEntry.is_cloud, isPypiPublished: isPypiConnector(registryEntry), @@ -70,7 +66,13 @@ const plugin = () => { syncSuccessRate, usageRate, lastUpdated, - }); + }; + + firstHeading = false; + node.children = []; + node.type = "mdxJsxFlowElement"; + node.name = "HeaderDecoration"; + node.attributes = toAttributes(attrDict); } }); };