feat: causal lab

This commit is contained in:
OpenSquared
2026-06-28 18:15:56 +02:00
parent 6ebbf4326e
commit aba599cec7

View File

@@ -407,7 +407,14 @@ function EventDetail({
const loadAnalyses = useCallback(async () => {
const r = await fetch(`/api/causal-lab/analyses?market_event_id=${event.id}&limit=20`)
if (r.ok) setAnalyses(await r.json())
if (r.ok) {
const data: CausalAnalysis[] = await r.json()
setAnalyses(data)
// Pre-select the most recent analysis's template so the form isn't blank on re-open
if (data.length > 0 && data[0].template_id) {
setSelTmpl(data[0].template_id)
}
}
}, [event.id])
useEffect(() => {