One of the ways you could approach this is to use Observable’s mutable operator, which lets you assign the value of a cell from another cell, and trigger any downstream cells with (non-mutable) references to that mutable cell to run again.
Here’s a suggestion that does that:
The basic steps are:
- Any cell that wants to mutate your database references
mutable te_items exclusively, and never
te_items (otherwise, you’d likely get an infinite loop).
- After the cell mutates the database, it reassigns
mutable te_items to itself to trigger downstream cells to run. (It’s generally better to use a copy-on-write technique here similar to React state, but that’s not possible given that this database is inherently mutable.)
- Any cell that you want to run automatically whenever
te_items changes just references
te_items as normal.
- But, if a cell depends on a specific mutation (such as the
find cell depending on the
add_data cell that inserts the tyrfing record), that cell must include a reference to the cell that applies the mutation. That’s because Observable runs cells in topological order.
Hope this helps.