From 5b6416938412da34b1459a484d9d6827c92c8800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Fankh=C3=A4nel?= Date: Wed, 27 Aug 2025 10:28:28 +0200 Subject: [PATCH] fix(TemplateListPage): fix tsc error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: David Fankhänel --- .../TemplateListPage/TemplateListPage.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx b/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx index 0a7a3df888..37a50ed904 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx @@ -149,18 +149,25 @@ export const TemplateListPage = (props: TemplateListPageProps) => { const additionalLinksForEntity = useCallback( (template: TemplateEntityV1beta3) => { - const hasTechDocs = - !!template.metadata.annotations?.[TECHDOCS_ANNOTATION] || - !!template.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]; + if ( + !( + template.metadata.annotations?.[TECHDOCS_ANNOTATION] || + template.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION] + ) || + !viewTechDocsLink + ) { + return []; + } - return hasTechDocs && viewTechDocsLink + const url = buildTechDocsURL(template, viewTechDocsLink); + return url ? [ { icon: app.getSystemIcon('docs') ?? DocsIcon, text: t( 'templateListPage.additionalLinksForEntity.viewTechDocsTitle', ), - url: buildTechDocsURL(template, viewTechDocsLink), + url, }, ] : [];