From 34962edc2018a5444fcf35ddd89a65a9598d6ca2 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sun, 3 May 2026 22:20:26 +0000 Subject: [PATCH] fix(step2): add null-guard for task_id in pollTaskUntilDone, add try/catch to confirmDeleteAgent --- frontend/src/components/Step2EnvSetup.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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}`) } }