From 415301463896baae7a9bf55281ce03b78aff2966 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 11:34:28 +0000 Subject: [PATCH] Changes Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com> --- src/routes/painel.skills.$id.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/routes/painel.skills.$id.tsx b/src/routes/painel.skills.$id.tsx index 90494f9..3792ea8 100644 --- a/src/routes/painel.skills.$id.tsx +++ b/src/routes/painel.skills.$id.tsx @@ -145,14 +145,14 @@ function SkillDetailPage() { return data; }, onSuccess: (data) => { - if (data.no_op) { + if (data?.no_op) { toast.info("Esta versão já está publicada"); - } else if (data.synced === false) { + } else if (data?.synced === false) { toast.warning(`Versão ${data.version_number} publicada, mas o sync falhou.`, { description: data.sync_error || "Tente novamente após o próximo deploy.", }); } else { - toast.success(`Versão ${data.version_number} publicada!`); + toast.success(`Versão ${data?.version_number ?? ""} publicada!`); } qc.invalidateQueries({ queryKey: ["skill-versions", id] }); qc.invalidateQueries({ queryKey: ["skill", id] }); @@ -181,13 +181,15 @@ function SkillDetailPage() { toast.success("Skill arquivada"); qc.invalidateQueries({ queryKey: ["skills"] }); qc.invalidateQueries({ queryKey: ["user-limits"] }); - void syncAgentSkills(skill.data.agent_instance_id).then(({ error }) => { - if (error) { - toast.warning("Skill arquivada, mas o sync com o container falhou.", { - description: error.message, - }); - } - }); + if (skill.data?.agent_instance_id) { + void syncAgentSkills(skill.data.agent_instance_id).then(({ error }) => { + if (error) { + toast.warning("Skill arquivada, mas o sync com o container falhou.", { + description: error.message, + }); + } + }); + } navigate({ to: "/painel/skills" }); }, onError: (e: unknown) => toast.error(e instanceof Error ? e.message : "Erro"),