Fix use as draft (#9413)

Closes #9408
This commit is contained in:
Raphaël Bosi
2025-01-07 10:21:00 +01:00
committed by GitHub
parent c61831c78a
commit 9392acbee5

View File

@ -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 {