How to group a longer user interaction into a single undo step?

I am trying to implement this functionality in my UXP panel. In the video I’m dragging the scale value left and right, Premiere shows the preview, and once I release the mouse button, a single undo step (history entry) is created.

The second video shows what I want to avoid - when I drag the slider, a new undo step is created for each value the slider has while dragging. This was implemented by calling project.executeTransaction on every slider value change.

I’ve tried to reuse the compoundAction I get in the callback for the executeTransaction function, but adding actions with compoundAction.addAction does nothing once the call to executeTransaction is finished. I’ll post a link to an example in a second post here, as I can include only two links as a new user.

Is there a better way to achieve this functionality? We need this in order to move our panel from CEP to UXP, as we provide controls for clip parameters, along with the slider/drag functionality, and creating tens of undo steps is bad UX. It was possible in ExtendScript using qe.project.undoStackIndex and qe.project.undo.

Here is a sample panel to better illustrate this approach. The panel can be loaded into UXP Dev Tools directly, there is no need to compile anything. In the repository I’ve included a minimal project that can be used with the panel. I am using beta version 25.3.0, build 20.

Thanks for letting us know of the issue and sharing the panel with detailed description!

Yes, adding action after executeTransaction finish won’t work.. executeTransaction would execute the compoundAction with all actions added so far and won’t re-execute if you add another action afterwards.

Unfortunately, there is no better way to achieve the same functionality without undo UIs for UXP at this point. If we group all actions into compound action and execute at once in the end, we will have single undoable action, but the parameter value will bump to the end value without the process of parameter changes align with slider change, which regrettably came to me after our discussions.

Thank you so much for your feedback! We have started discussions internally to deal with use case like this. We will keep you guys updated in the forum.

1 Like