|
|
|
|
|
by bbsimonbb
914 days ago
|
|
As I've just written above, React components form a tree that mirrors the DOM. A graph is a much better fit. Nodes in my DAG ressemble "computed" in Vue, where they watch a value and recalculate when it changes, but... in Vue the watched value needs to exist, ie you're responsible for constructing the graph and ensuring no cycles, and the computed value is only available locally, to be used in the template. In my DAG, you just name the thing you want to watch, octopus checks for cycles. Plus you get the visualization. The closest thing I'm aware of is Jotai. Atoms in jotai can take dependencies on other atoms, so forming a graph. Reporting nodes in Octopus are, I believe, completely new. You can create nodes that select their predecessors with a filter function. So the "totalPrice" node takes a dependency on any node with a price property, and recalculates when anything with a price changes. |
|
Not all acyclic graphs are trees, but all trees are acyclic graphs. As such this part of your description is confusing.
Your last paragraph does a much better job at explaining how it differs.