diff --git a/frontend/src/pages/CausalLab.tsx b/frontend/src/pages/CausalLab.tsx index ef99c93..1939176 100644 --- a/frontend/src/pages/CausalLab.tsx +++ b/frontend/src/pages/CausalLab.tsx @@ -386,6 +386,7 @@ function TabLibrary({ initialTemplateId }: { initialTemplateId?: number | null } const [genTheory, setGenTheory] = useState(false) const [editCoefs, setEditCoefs] = useState>({}) const [editEdgesLag, setEdgesLag] = useState([]) + const [lagDirty, setLagDirty] = useState(false) const [loading, setLoading] = useState(true) const [apiError, setApiError] = useState(null) const [debugInfo, setDebugInfo] = useState | null>(null) @@ -414,6 +415,7 @@ function TabLibrary({ initialTemplateId }: { initialTemplateId?: number | null } Object.entries(t.graph_json?.coefficients || {}).map(([k, v]) => [k, v.value]) )) setEdgesLag(JSON.parse(JSON.stringify(t.graph_json?.edges || []))) + setLagDirty(false) } async function saveCoefs() { @@ -441,6 +443,7 @@ function TabLibrary({ initialTemplateId }: { initialTemplateId?: number | null } const fresh = await api(`/api/causal-lab/template/${selected.id}`) setSelected(fresh) setEdgesLag(JSON.parse(JSON.stringify(fresh.graph_json?.edges || []))) + setLagDirty(false) } finally { setSavingLag(false) } } @@ -474,6 +477,7 @@ function TabLibrary({ initialTemplateId }: { initialTemplateId?: number | null } [field]: val === '' ? (field === 'decay_days' ? null : undefined) : (field === 'decay_days' ? parseFloat(val) : parseInt(val)), })) + setLagDirty(true) } async function deleteTemplate() { @@ -642,8 +646,12 @@ function TabLibrary({ initialTemplateId }: { initialTemplateId?: number | null } ))} )}