diff --git a/plugins/catalog/src/components/EntitySwitch/EntitySwitch.tsx b/plugins/catalog/src/components/EntitySwitch/EntitySwitch.tsx index 90de358ef9..b12495052e 100644 --- a/plugins/catalog/src/components/EntitySwitch/EntitySwitch.tsx +++ b/plugins/catalog/src/components/EntitySwitch/EntitySwitch.tsx @@ -77,18 +77,14 @@ export const EntitySwitch = (props: EntitySwitchProps) => { }) .getElements() .flatMap((element: ReactElement) => { + // If the entity is missing or there is an error, render nothing + if (!entity) { + return []; + } + const { if: condition, children: elementsChildren } = element.props as EntitySwitchCase; - // If the entity is missing or there is an error, render the default page - if (!entity) { - return [ - { - if: condition === undefined, - children: elementsChildren, - }, - ]; - } return [ { if: condition?.(entity, { apis }),