Skip to content

Commit 980f09b

Browse files
committed
feat: allow to discard a draft only if it's not the first workflow version (no version prior to this one)
1 parent 8f87d16 commit 980f09b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/twenty-front/src/modules/workflow/components/RecordShowPageHeaderWorkflow.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export const RecordShowPageHeaderWorkflow = ({
3737
onClick={() => {}}
3838
/>
3939

40-
{workflowWithCurrentVersion?.currentVersion?.status === 'DRAFT' ? (
40+
{workflowWithCurrentVersion?.currentVersion?.status === 'DRAFT' &&
41+
workflowWithCurrentVersion.versions?.length > 1 ? (
4142
<Button
4243
title="Discard Draft"
4344
variant="secondary"

packages/twenty-front/src/modules/workflow/hooks/useWorkflowWithCurrentVersion.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const useWorkflowWithCurrentVersion = (
1919
id: true,
2020
name: true,
2121
statuses: true,
22+
versions: true,
2223
},
2324
skip: !isDefined(workflowId),
2425
});

0 commit comments

Comments
 (0)