Skip to content

Commit

Permalink
bug(docs): Fix backup path on null (#39575)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnchrch authored Jun 18, 2024
1 parent b7c381c commit 98f892f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docusaurus/src/helpers/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
16 changes: 9 additions & 7 deletions docusaurus/src/remark/docsHeaderDecoration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -70,7 +66,13 @@ const plugin = () => {
syncSuccessRate,
usageRate,
lastUpdated,
});
};

firstHeading = false;
node.children = [];
node.type = "mdxJsxFlowElement";
node.name = "HeaderDecoration";
node.attributes = toAttributes(attrDict);
}
});
};
Expand Down

0 comments on commit 98f892f

Please sign in to comment.