feat: causal lab

This commit is contained in:
OpenSquared
2026-06-29 14:33:26 +02:00
parent ac441ad5cb
commit bec6d5590a

View File

@@ -520,11 +520,11 @@ function EventDetail({
})
const cd = await cr.json()
if (!cr.ok) throw new Error(cd.detail || cr.statusText)
const newTmplId = cd.template?.id ?? cd.template_id
const newTmplId = cd.id ?? cd.template?.id ?? cd.template_id
if (newTmplId) {
setTemplates(prev => [...prev, cd.template].filter(Boolean))
setTemplates(prev => [...prev, { id: newTmplId, name: cd.name, category: cd.category, graph_json: cd.graph_json, instruments: cd.instruments, calibration_json: {} }])
setSelTmpl(newTmplId)
setRecMsg(`✦ Nouveau template créé : ${cd.template?.name ?? 'template'}`)
setRecMsg(`✦ Nouveau template créé : ${cd.name ?? 'template'}`)
await instantiate(newTmplId)
} else {
setRecMsg('Template créé mais ID manquant')