diff --git a/frontend/src/components/Step2EnvSetup.vue b/frontend/src/components/Step2EnvSetup.vue index 16d6170c..700d4396 100644 --- a/frontend/src/components/Step2EnvSetup.vue +++ b/frontend/src/components/Step2EnvSetup.vue @@ -613,7 +613,7 @@

Persona: {{ selectedAgent?.persona }}

@@ -1189,6 +1189,7 @@ const loadPreparedData = async () => { // ---- Fase A/B helpers ---- const pollTaskUntilDone = async (taskId, onComplete, intervalMs = 2000) => { + if (!taskId) { onComplete && onComplete(); return } return new Promise((resolve) => { const interval = setInterval(async () => { try { @@ -1243,9 +1244,14 @@ const saveAgent = async () => { const confirmDeleteAgent = async (agent) => { if (!confirm(t('step2.deleteAgentConfirm'))) return - const res = await deleteAgent(props.simulationId, agent.user_id) - if (res.data?.success) { - profiles.value = profiles.value.filter(p => p.user_id !== agent.user_id) + try { + const res = await deleteAgent(props.simulationId, agent.user_id) + if (res.data?.success) { + profiles.value = profiles.value.filter(p => p.user_id !== agent.user_id) + closeAgentModal() + } + } catch (err) { + addLog(`Delete failed: ${err.message}`) } }