Skip to content

The open alternative to Salesforce, designed for AI.

Fix use as draft (#9413)

Raphaël Bosi9392acbee5a0
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useUseAsDraftWorkflowVersionSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useUseAsDraftWorkflowVersionSingleRecordAction.tsx
index 1ea5642558c..ead701182b1 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useUseAsDraftWorkflowVersionSingleRecordAction.tsx
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/hooks/useUseAsDraftWorkflowVersionSingleRecordAction.tsx
@@ -30,19 +30,17 @@ export const useUseAsDraftWorkflowVersionSingleRecordAction: ActionHookWithoutOb
const navigate = useNavigate();
- const workflowStatuses = workflow?.statuses;
+ const hasAlreadyDraftVersion =
+ workflow?.versions.some((version) => version.status === 'DRAFT') || false;
const shouldBeRegistered =
isDefined(workflowVersion) &&
isDefined(workflow) &&
- isDefined(workflowStatuses) &&
workflowVersion.status !== 'DRAFT';
const onClick = async () => {
if (!shouldBeRegistered) return;
- const hasAlreadyDraftVersion = workflowStatuses.includes('DRAFT');
-
if (hasAlreadyDraftVersion) {
setOpenOverrideWorkflowDraftConfirmationModal(true);
} else {