Skip to content

Commit

Permalink
feat: allow to discard a draft only if it's not the first workflow ve…
Browse files Browse the repository at this point in the history
…rsion (no version prior to this one)
  • Loading branch information
Devessier committed Sep 18, 2024
1 parent 8f87d16 commit 980f09b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export const RecordShowPageHeaderWorkflow = ({
onClick={() => {}}
/>

{workflowWithCurrentVersion?.currentVersion?.status === 'DRAFT' ? (
{workflowWithCurrentVersion?.currentVersion?.status === 'DRAFT' &&
workflowWithCurrentVersion.versions?.length > 1 ? (
<Button
title="Discard Draft"
variant="secondary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const useWorkflowWithCurrentVersion = (
id: true,
name: true,
statuses: true,
versions: true,
},
skip: !isDefined(workflowId),
});
Expand Down

0 comments on commit 980f09b

Please sign in to comment.