Skip to content

Commit

Permalink
Added a empty array check in CSA (ToolJet#3812)
Browse files Browse the repository at this point in the history
  • Loading branch information
kavinvenkatachalam authored Aug 24, 2022
1 parent 55cf287 commit 4199001
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/src/Editor/Inspector/EventManager.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export const EventManager = ({

function getComponentActionOptions(componentId) {
if (componentId == undefined) return [];
const component = Object.entries(components ?? {}).filter(([key, _value]) => key === componentId)[0][1];
const filteredComponents = Object.entries(components ?? {}).filter(([key, _value]) => key === componentId);
if (_.isEmpty(filteredComponents)) return [];
const component = filteredComponents[0][1];
const targetComponentMeta = componentTypes.find(
(componentType) => component.component.component === componentType.component
);
Expand All @@ -124,7 +126,9 @@ export const EventManager = ({

function getAction(componentId, actionHandle) {
if (componentId == undefined || actionHandle == undefined) return {};
const component = Object.entries(components ?? {}).filter(([key, _value]) => key === componentId)[0][1];
const filteredComponents = Object.entries(components ?? {}).filter(([key, _value]) => key === componentId);
if (_.isEmpty(filteredComponents)) return {};
const component = filteredComponents[0][1];
const targetComponentMeta = componentTypes.find(
(componentType) => component.component.component === componentType.component
);
Expand Down

0 comments on commit 4199001

Please sign in to comment.