Currently I apply some Annotations to transactions to exclude them an “always on” effect running via an UpdateListener extension. I was under the impression that history undo transactions would retain these annotations as well, and thus would also get this exclusion behavior, but I don’t think that is the case (my notes here for anyone interested in the debugging that led here).
In order to achieve the effect I’m looking for, where this UpdateListener’s effects are ignored both forwards and while undoing, should I make use of invertedEffects somehow? I thought I could only apply effects through that, so I’m unclear on how to configure my annotations to apply in the undo case.
Indeed, they do not. An undo/redo effect is a new transaction, with no annotations of the transaction(s) that the changes originate in. The history tracks changes and effects, not the transactions they come from, and may combine changes and effects from multiple transactions into a single history ‘event’, so there’s not really a meaningful way to preserve annotations in history.
Okay, yes that makes sense, especially with the grouping behavior that would break things to group Annotations from multiple Transactions.
I probably shouldn’t be operating that “always on” effect via UpdateListener anyway, that seems like an anti-pattern. I’ll rework it to be an explicit opt-in effect of its own. Then when that is a StateEffect, undo will still fire it, but if it’s left out of a transaction it (of course) won’t have an effect then as well.