reposting this in the bug reports forum, since I think it is a bug and I posted it wrongly in the JSFX forum first.

I don't expect the "Change FX preset: Track 1: ReaEQ" to appear in the undo history. It should be enclosed by the Undo Block. So it seems a bug, that after the undo block is created, another undo entry is added for setting the preset. If you add multiple different TrackFX_SetPreset, a lot of undo entries are added.

I've done an alternative way to code this using get/set chunks that doesn't generate undo. But it is not CPU friendly, and it generates audio glitches if used when playing. Sometimes I need to set preset for 10 or 20 tracks at once. so I have the option to use reaper.TrackFX_SetPreset which generates 20 undo entries, or use chunks and deal with audio glitches.
If at least I could group all 20 undo entries in one undo block it would be better.