Skip to content

Commit

Permalink
Fix use as draft (#9413)
Browse files Browse the repository at this point in the history
Closes #9408
  • Loading branch information
bosiraphael authored Jan 7, 2025
1 parent c61831c commit 9392acb
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9392acb

Please sign in to comment.