I am running modeler in a React app, and my end goal is to console.log an updated XML config – after I have deleted icons from model.
My app first creates a new modeler instance:
componentDidMount = () => {
this.modeler = new BpmnModeler({
container: "#bpmnview",
keyboard: {
bindTo: window
}
});
this.getDiagram();
};
to then open the diagram (XML string fetched from API) like so:
openBpmnDiagram = xml => {
this.modeler.importXML(xml, error => {
if (error) {
return console.log("fail import xml");
}
const canvas = this.modeler.get("canvas");
canvas.zoom("fit-viewport");
});
};
Everything is rendering fine, but when I call the following function:
getUpdatedXML = () => {
return new Promise((accept, reject) => {
this.modeler._moddle.toXML(
this.modeler.get("canvas"),
{
format: true
},
(err, response) => {
if (err) return reject(err);
return accept(response);
}
);
});
};
then it returns the error: error getting updated XML TypeError: Cannot read property 'isGeneric' of undefined