From b21fb3ae269e69b77086a617b55498d9181db006 Mon Sep 17 00:00:00 2001 From: victormorfin97 Date: Fri, 27 Aug 2021 08:24:11 -0500 Subject: [PATCH] use a const instead of a condition to render the card component Signed-off-by: victormorfin97 --- .../components/TemplateList/TemplateList.tsx | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx b/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx index fb9a73f85e..b23ef16eba 100644 --- a/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx +++ b/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx @@ -15,7 +15,10 @@ */ import React, { ComponentType } from 'react'; -import { TemplateEntityV1beta2 } from '@backstage/catalog-model'; +import { + stringifyEntityRef, + TemplateEntityV1beta2, +} from '@backstage/catalog-model'; import { ItemCardGrid, Progress, @@ -35,6 +38,7 @@ export type TemplateListProps = { export const TemplateList = ({ TemplateCardComponent }: TemplateListProps) => { const { loading, error, entities } = useEntityListProvider(); + const Card = TemplateCardComponent || TemplateCard; return ( <> {loading && } @@ -58,19 +62,12 @@ export const TemplateList = ({ TemplateCardComponent }: TemplateListProps) => { {entities && entities?.length > 0 && - entities.map((template, i) => - TemplateCardComponent ? ( - - ) : ( - - ), - )} + entities.map(template => ( + + ))} );