diff --git a/frontend/src/app/pages/Workflows/EditAgentView.tsx b/frontend/src/app/pages/Workflows/EditAgentView.tsx index 7ce31a71..75085b42 100644 --- a/frontend/src/app/pages/Workflows/EditAgentView.tsx +++ b/frontend/src/app/pages/Workflows/EditAgentView.tsx @@ -113,6 +113,7 @@ export default function EditAgentView({ workflow, steps, isFixMode = false, onEd const [testSessionId, setTestSessionId] = useState(null); const draftSteps = workflow.draft_steps ?? steps; const canSave = draftSteps.some((s) => (s.text || '').trim().length > 0); + const allowDiscard = !workflow.unsaved; // A draft always exists in edit mode (we snapshot on entry), so only flag // "unsaved" once the draft actually diverges from the committed steps. const hasChanges = workflow.draft_steps != null && JSON.stringify(workflow.draft_steps) !== JSON.stringify(workflow.steps); @@ -205,12 +206,14 @@ export default function EditAgentView({ workflow, steps, isFixMode = false, onEd ยท unsaved )} - - Discard - + {allowDiscard && ( + + Discard + + )}