I use ComboBox with UndoManager.
The ComboBox selected item refers to ValueTree property, so Undo/Redo works automatically.
Things get problematic when something outside of the described above system needs to update the ComboBox item list content AND also has to work properly with UndoManager for proper Undo/Redo.
The problem is this:
Undo/Redo for that outside system might add or remove items from that ComboBox item list. The only way to do this is manually, instead of relying on UndoManager. To remove items you first need to clear the whole list and then add the remaining items back into the list. If the ComboBox selected item is referring to ValueTree property, that property will change during this operation. That messes up the Undo/Redo history as it suddenly adds new change to the UndoManager which wasn’t there before.
How to go around this issue? How do I make ComboBox update its item list with Undo/Redo?
TLDR:
Undo/Redo for X requires “manual” updates (done outside UndoManager) to ComboBox item list content, which adds new items to UndoManager history. This messes up the Undo/Redo history.
The exact use case scenario is that the Combobox is owned by a mixer audio channel Component, which should update the Combobox content every time output audio channel Components are added/deleted from the screen. I.e. the Combobox should list available output audio channels.
