mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 06:16:42 +00:00
Added null guards for skills data
X-Lovable-Edit-ID: edt-d7326074-caf8-418c-a10d-56fddedb5065 Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
commit
8a70a19a91
1 changed files with 12 additions and 10 deletions
|
|
@ -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,6 +181,7 @@ function SkillDetailPage() {
|
|||
toast.success("Skill arquivada");
|
||||
qc.invalidateQueries({ queryKey: ["skills"] });
|
||||
qc.invalidateQueries({ queryKey: ["user-limits"] });
|
||||
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.", {
|
||||
|
|
@ -188,6 +189,7 @@ function SkillDetailPage() {
|
|||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
navigate({ to: "/painel/skills" });
|
||||
},
|
||||
onError: (e: unknown) => toast.error(e instanceof Error ? e.message : "Erro"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue