Hi,
I’m using the properties panel along with async extensions that I implemented using the example on github (bpmn-js-examples/properties-panel-async-extension at main · bpmn-io/bpmn-js-examples · GitHub). So I have a custom provider that collects all the groups. Inside the groups I use preact hooks for the asynchronous properties.
Example for an async call inside a group (added for call activities):
export default function (args) {
const {element} = args;
const [values, setValues] = useState({});
useEffect(() => {
if (!values.diagrams) {
getDiagrams().then(diagrams => setValues((existing) => { return {...existing, diagrams: diagrams}; }));
}
}, [element.id]);
const {diagrams} = values;
const entries = [];
// use diagrams for a select list and add this to entries
return entries;
I used the object syntax in the return value so I can re-use the same data over multiple properties, which worked fine so far.
Now I’ve updated the dependencies of @bpmn-io/properties-panel and
bpmn-js-properties-panel to the latest version and now I get an error, as soon as I place an element on the canvas that uses this group.
Error message in the console:
Uncaught (in promise) TypeError: function is not iterable (cannot read property Symbol(Symbol.iterator))
at b.BpmnPropertiesPanel [as constructor] (index.esm.js:1605:43)
That leads to the following part inside bpmn-js-properties-panel:
// (5) notify layout changes
const [layoutConfig, setLayoutConfig] = useState(initialLayoutConfig || {});
const onLayoutChanged = useCallback(newLayout => {
eventBus.fire('propertiesPanel.layoutChanged', {
layout: newLayout
});
}, [eventBus]);
If I’m correct that change came in version 1.21.0, I was below that version before, so that would fit.
I can’t find out, why this error comes up now and even more, why only at this position. I use the same syntax on a property group on process level - so it gets executed directly on loading a diagram, which works fine - and also on other elements, but there dependant on another property which has to be selected first, so this doesn’t get executed directly when adding the object.
So my assumption would be, that it’s some kind of timing issue or that the useEffect calls block each other, but I don’t really see a way around for that here.
Any help or ideas welcome