I notice that the $OnRemove action of a container (or adornment) fires when a note in the container is dragged out, but not when a note in the container is deleted. I think I get why (namely because OnRemove actions have to run on a note, and the note to run it on has just been deleted), but it makes it annoyingly difficult to maintain state within a container without resorting to an agent.
For example, I have an expense prototype, and it would be great to be able to nest expenses so that the amount of the expense is the sum of the amount of its children. I could do this with an agent, of course, but it’s even simpler to do with OnAdd and OnRemove actions. However, this gets messed up if you delete a nested expense rather than moving it out of the container. Is there a nice way to do this, or do I just have to use an agent?
How feasible would it be to support firing OnRemove on the note to be deleted just before deleting it?