diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowDropdownStepOutputItems.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowDropdownStepOutputItems.tsx index 57ac4bccf0..974282c402 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowDropdownStepOutputItems.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowDropdownStepOutputItems.tsx @@ -229,28 +229,34 @@ export const WorkflowDropdownStepOutputItems = ({ {filteredOptions.length > 0 && shouldDisplaySubStepObject && ( )} - {filteredOptions.map(([key, subStep]) => ( - handleSelectField(key)} - text={subStep.label || key} - hasSubMenu={!subStep.isLeaf} - LeftIcon={ - subStep.icon - ? getIcon(subStep.icon) - : getIcon( - getStepItemIcon({ - itemType: subStep.type, - }), - ) - } - contextualText={ - subStep.isLeaf ? subStep?.value?.toString() : undefined - } - /> - ))} + {filteredOptions.map(([key, subStep]) => { + if (!isDefined(subStep)) { + return null; + } + + return ( + handleSelectField(key)} + text={subStep.label || key} + hasSubMenu={!subStep.isLeaf} + LeftIcon={ + subStep.icon + ? getIcon(subStep.icon) + : getIcon( + getStepItemIcon({ + itemType: subStep.type, + }), + ) + } + contextualText={ + subStep.isLeaf ? subStep?.value?.toString() : undefined + } + /> + ); + })} ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx index 8b40cff6fa..d5afe47f7c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx @@ -136,28 +136,34 @@ export const WorkflowVariablesDropdownStepItems = ({ {filteredOptions.length > 0 && shouldDisplaySubStepObject && ( )} - {filteredOptions.map(([key, subStep]) => ( - handleSelectField(key)} - text={subStep.label || key} - hasSubMenu={!subStep.isLeaf} - LeftIcon={ - subStep.icon - ? getIcon(subStep.icon) - : getIcon( - getStepItemIcon({ - itemType: subStep.type, - }), - ) - } - contextualText={ - subStep.isLeaf ? subStep?.value?.toString() : undefined - } - /> - ))} + {filteredOptions.map(([key, subStep]) => { + if (!isDefined(subStep)) { + return null; + } + + return ( + handleSelectField(key)} + text={subStep.label || key} + hasSubMenu={!subStep.isLeaf} + LeftIcon={ + subStep.icon + ? getIcon(subStep.icon) + : getIcon( + getStepItemIcon({ + itemType: subStep.type, + }), + ) + } + contextualText={ + subStep.isLeaf ? subStep?.value?.toString() : undefined + } + /> + ); + })} ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/filterOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/filterOutputSchema.ts index 4510724cca..5afdec8974 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/filterOutputSchema.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/filterOutputSchema.ts @@ -104,6 +104,10 @@ const filterBaseOutputSchema = ({ for (const key in outputSchema) { const field = outputSchema[key]; + if (!isDefined(field)) { + continue; + } + if (field.isLeaf) { if (isFieldTypeCompatibleWithRecordId(field.type)) { filteredSchema[key] = field;