From 3fa12bb9fc70e32e6d0c71e91225847a125255d4 Mon Sep 17 00:00:00 2001 From: Thomas Trompette Date: Thu, 2 Oct 2025 11:04:38 +0200 Subject: [PATCH] Search record schema migration breaks following workflow steps (#14833) If iterator loop feature flag is not enabled, `all` field in undefined in search record schema. We need to handle that case properly. --- .../WorkflowDropdownStepOutputItems.tsx | 50 +++++++++++-------- .../WorkflowVariablesDropdownStepItems.tsx | 50 +++++++++++-------- .../utils/filterOutputSchema.ts | 4 ++ 3 files changed, 60 insertions(+), 44 deletions(-) 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;