From 18820facbb71b910bd183a7da3ecff499f6cd9ba Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 14 Jul 2023 15:27:53 -0300 Subject: [PATCH] added fallback icon in IconComponent --- src/frontend/src/components/genericIconComponent/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/components/genericIconComponent/index.tsx b/src/frontend/src/components/genericIconComponent/index.tsx index a5dc7f632..cca138100 100644 --- a/src/frontend/src/components/genericIconComponent/index.tsx +++ b/src/frontend/src/components/genericIconComponent/index.tsx @@ -2,12 +2,12 @@ import { IconComponentProps, IconProps } from "../../types/components"; import { nodeIconsLucide, svgIcons } from "../../utils"; export function IconFromLucide({ name }: IconProps): JSX.Element { - const TargetIcon = nodeIconsLucide[name]; + const TargetIcon = nodeIconsLucide[name] ?? nodeIconsLucide["unknown"]; return ; } export function IconFromSvg({ name }: IconProps): JSX.Element { - const TargetSvg = svgIcons[name]; + const TargetSvg = svgIcons[name] ?? nodeIconsLucide["unknown"]; return ; } @@ -21,6 +21,7 @@ export default function IconComponent({ case "LUCIDE": return ; default: - return; + console.error("IconComponent: invalid method"); + return ; } }