From c281928850aba8ec6328d22cccd53eedd517e28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20B=C3=A4r?= Date: Tue, 19 Nov 2024 18:00:43 +0100 Subject: [PATCH] fix: nulling `latestVersionInfo` in VersionBanner --- packages/plugin/package.json | 2 +- .../plugin/src/components/VersionBanner.tsx | 40 ++++++++++--------- packages/plugin/src/index.ts | 2 +- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/packages/plugin/package.json b/packages/plugin/package.json index 0e5d99c..dc7a2bf 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@apify/docusaurus-plugin-typedoc-api", - "version": "4.2.11-3", + "version": "4.2.11-4", "description": "Docusaurus plugin that provides source code API documentation powered by TypeDoc. ", "keywords": [ "docusaurus", diff --git a/packages/plugin/src/components/VersionBanner.tsx b/packages/plugin/src/components/VersionBanner.tsx index 2b2e1c2..4b76062 100644 --- a/packages/plugin/src/components/VersionBanner.tsx +++ b/packages/plugin/src/components/VersionBanner.tsx @@ -23,25 +23,27 @@ export function VersionBanner(): JSX.Element | null { const latestVersionInfo = docs[latestVersion.label]; return ( -
-
- {banner === 'unreleased' && <>This is documentation for an unreleased version.} - {banner === 'unmaintained' && ( - <> - This is documentation for version {version}. - - )}{' '} - For the latest API, see version{' '} - - - {latestVersionInfo.title} - - - . + latestVersionInfo ? ( +
+
+ {banner === 'unreleased' && <>This is documentation for an unreleased version.} + {banner === 'unmaintained' && ( + <> + This is documentation for version {version}. + + )}{' '} + For the latest API, see version{' '} + + + {latestVersionInfo.title} + + + . +
-
+ ) : null ); } diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index 68a6217..6204191 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -287,7 +287,7 @@ export default function typedocApiPlugin( } actions.setGlobalData({ - isPython: !!(options.python || Object.keys(options.pythonOptions).length > 0), + isPython: !!(options.python || (Object.keys(options.pythonOptions).length > 0)), } as GlobalData); const docs: PropVersionDocs = {};