From 658d2d38077b768ea02439edf62eb088f9b06ef7 Mon Sep 17 00:00:00 2001 From: abccodes Date: Thu, 18 Jun 2026 04:11:06 -0700 Subject: [PATCH] [aidan] ux/edit-agent: hide Discard for an unsaved new workflow --- .../src/app/pages/Workflows/EditAgentView.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 + + )}