commandStack.changed does not trigger

Hello everyone,

we have build a custom variant of bpmn.io based on the example properties-panel-extension. It involves custom ServiceTasks with custom properties and is causing me a bit of a headache.

Problem
When I edit a property on my custom panel tab, commandStack.changed does not trigger. The edit is visible and persists over selecting a different element, but does not appear when exporting to .bpmn. If I then add another element or edit something on the general tab commandStack.changed triggeres and the export contains the change made earlier as well.

What I’ve tried so far
I’ve compared our code to the aforementioned example and tried to reproduce it in a Codesandbox, but to no avail.

What I’m looking for
Since I can’t reproduce the bug in a Codesandbox and I am not free to share the full code of our application with you, I’m mostly looking to understand the principles here. How is commandStack.changed triggered after a change in the properties panel and how could one disable this (so where could I have gone wrong).

commandStack.changed is triggered any time when a command is fired. Commands can be registered to the commandStack, e.g. modeling commands in bpmn-js. Commands make sure updates to your BPMN 2.0 XML are properly captured and can be undone & redone.

In the (current) properties panel implementation, commands are created via a command helper, e.g. for ID properties. The properties panel itself then makes sure, that the created command got executed when an input is updated, it simply checks whether one or more commands are given via one entry’s setValue handler and executes them.

So tldr: to make sure properties updates are properly made, make sure your setValue retrieves a valid command to be executed. Simply (directly) updating elements & business objects won’t work.