From c1f040860581d0d8ade81c550a10c6c7116bf463 Mon Sep 17 00:00:00 2001 From: Arpit Date: Thu, 10 Nov 2022 15:51:45 +0530 Subject: [PATCH] fixes icon crash for plugins (#4744) --- frontend/src/Editor/LeftSidebar/SidebarInspector.jsx | 2 +- frontend/src/_helpers/appUtils.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/Editor/LeftSidebar/SidebarInspector.jsx b/frontend/src/Editor/LeftSidebar/SidebarInspector.jsx index df4d439206..095b6a2e4c 100644 --- a/frontend/src/Editor/LeftSidebar/SidebarInspector.jsx +++ b/frontend/src/Editor/LeftSidebar/SidebarInspector.jsx @@ -78,7 +78,7 @@ export const LeftSidebarInspector = ({ } const icon = dataSources.find((ds) => ds.kind === value.kind); const iconFile = icon?.plugin?.icon_file?.data ?? undefined; - const Icon = () => getSvgIcon(icon.kind, 25, 25, iconFile); + const Icon = () => getSvgIcon(icon?.kind, 25, 25, iconFile ?? undefined); return { iconName: key, jsx: () => }; }); diff --git a/frontend/src/_helpers/appUtils.js b/frontend/src/_helpers/appUtils.js index e0fda75005..ca523f009e 100644 --- a/frontend/src/_helpers/appUtils.js +++ b/frontend/src/_helpers/appUtils.js @@ -997,6 +997,8 @@ export const getSvgIcon = (key, height = 50, width = 50, iconFile = undefined, s if (key === 'runjs') return ; const Icon = allSvgs[key]; + if (!Icon) return <>; + return ; };