@Fortune For all enabled parameter of course (that's what I did in the snippet), but one by one.
If you change knob1 value, then knob2 (so two changes), you'll need to click twice UNDO to recover the previous settings. Like any undo in any software, you need to click as many times as you want to go back in time... You cannot click only one time to change all parameters at once (that's what A/B aims to)

It does coallescate simultaneous events into one action, but using it for an A/B scheme is a nasty hack.

So how would you do that? not for an A/B use, but I'm curious on how to undo/redo several parameters at once using these methods, that's counter-intuitive with general undo/redo behaviour
In my (simple) snippet, it does it one by one...
I can see a hack for A/B using undo/redo but it's nasty (certainly more than one of yours )

What it basically does is to run a timer that is executed every 500ms (or something like that) and coallescate undoable actions that appear in that time frame into one undoable action. Otherwise you would have to press Cmd+Z 20 times if you moved a slider.

Normally this time is short enough to not coallescate different parameter changes.

That's all done behind the scenes and is the same way the undo manager in script node and the interface designer works.

If you think about it it still is: if you have some sort of macro button that isn't connected to the undo management system, but changes 8 parameters at the same time, you still would expect that they are being undoed with one Cmd+Z keypress.

There's literally no scenario except for when you're monkeying around on your UI where this becomes an actual problem, but solves countless edge case things - believe me, it was implemented differently and it was buggy as hell.

@Christoph-Hart For an A/B comparison, I was thinking of using preset save/load via script, but we are hitting the validation window problem as soon as you want to overwrite the A or B preset...
Maybe an array containing all values combined with component.changed() would do it for an A/B?

@Fortune this snippet works as a compare A and B, but is only for those parameters you assign to the function, I have 2 buttons and 2 knobs in this example and it seems to work, but storing floating tiles values like the velocity etc in an arpeggiator it will be more complicated I guess
And this is not comparing a preset from the preset manager and modified settings, but maybe it suits your purpose, I don't know.
For comparing you have to press the "SnapShot" button and then start modifying the settings.
With the Compare button" you will be able to flip between the A and B