Enable a single undo for multiple operations?

Is it possible for a plugin to “batch” multiple operations (e.g., multiple calls to InstanceNode. setProperties triggered by a single user action in the plugin) into a single undo?

For example, if I’m just using native Figma and I select multiple component instances and then change a property for all of them, a single undo will revert that property change for all the instances simultaneously.

In a plugin I’m developing, I’ve got a feature where I take a single user action (like the press of a button in the plugin UI) and update multiple selected nodes similarly to the example above. However, when the operation completes, each instance has its own undo added to the undo history, making it cumbersome to revert all the property changes.

I’ve found the documentation for commitUndo, but none of my experiments with that function and have given me the “one undo reverts all bulk changes” behavior that I’m looking for. Please help! :sweat_smile: