Register a derived node whose compute can be hot-swapped.
The returned LiveDerivedHandle exposes a replace(next) method that updates the closure and bumps a hidden version Input in a single commit, producing exactly one downstream notification.
replace(next)
The derived value type.
The graph to register the derivation against.
Stable id for the derivation; must be unique within graph.
graph
The initial compute closure.
A handle whose replace swaps the compute in-place.
replace
const total = liveDerived(graph, 'total', (get) => get(a) + get(b))total.replace((get) => get(a) * get(b)) // one commit, one notify Copy
const total = liveDerived(graph, 'total', (get) => get(a) + get(b))total.replace((get) => get(a) * get(b)) // one commit, one notify
Register a derived node whose compute can be hot-swapped.
The returned LiveDerivedHandle exposes a
replace(next)method that updates the closure and bumps a hidden version Input in a single commit, producing exactly one downstream notification.