diff --git a/src/components/crown/utils.js b/src/components/crown/utils.js index 16bc84237..464af592f 100644 --- a/src/components/crown/utils.js +++ b/src/components/crown/utils.js @@ -62,15 +62,16 @@ export function removeNodeAssociations(node, modeler) { export function removeBoundaryEvents(graph, node, removeNode) { const nodeShape = graph.getCells().find(el => el.component && el.component.node === node); - - nodeShape.getEmbeddedCells({ deep: true }) - .filter(cell => { - return cell.component && cell.component.node.isBpmnType('bpmn:BoundaryEvent'); - }) - .forEach(boundaryEventShape => { - graph.getConnectedLinks(boundaryEventShape).forEach(shape => removeNode(shape.component.node)); - removeNode(boundaryEventShape.component.node); - }); + if (nodeShape) { + nodeShape.getEmbeddedCells({ deep: true }) + .filter(cell => { + return cell.component && cell.component.node.isBpmnType('bpmn:BoundaryEvent'); + }) + .forEach(boundaryEventShape => { + graph.getConnectedLinks(boundaryEventShape).forEach(shape => removeNode(shape.component.node)); + removeNode(boundaryEventShape.component.node); + }); + } } export function removeOutgoingAndIncomingRefsToFlow(node){ diff --git a/src/components/nodes/pool/pool.vue b/src/components/nodes/pool/pool.vue index bb6850617..89daaa83d 100644 --- a/src/components/nodes/pool/pool.vue +++ b/src/components/nodes/pool/pool.vue @@ -148,12 +148,13 @@ export default { /* Remove references to the element from the current process */ pull(this.containingProcess.get('flowElements'), elementDefinition); - toPool.component.containingProcess.get('flowElements').push(elementDefinition); - this.moveEmbeddedElements(element, toPool); - element.component.node.pool = toPool; + this.shape.unembed(element); toPool.component.shape.embed(element); + if (element.component.node.type !== laneId && toPool.component.laneSet) { + toPool.component.updateLaneChildren(); + } }, moveElement(element, toPool) { diff --git a/src/multiplayer/multiplayer.js b/src/multiplayer/multiplayer.js index 4776d6a5b..b49a555da 100644 --- a/src/multiplayer/multiplayer.js +++ b/src/multiplayer/multiplayer.js @@ -248,10 +248,6 @@ export default class Multiplayer { const { paper } = this.modeler; const element = this.modeler.getElementByNodeId(data.id); const newPool = this.modeler.getElementByNodeId(data.poolId); - // validate if the parent pool was updated - if (newPool && element.component.node.pool && element.component.node.pool.component.id !== data.poolId) { - element.component.node.pool.component.moveElementRemote(element, newPool); - } // Update the element's position attribute element.resize( /* Add labelWidth to ensure elements don't overlap with the pool label */ @@ -260,7 +256,13 @@ export default class Multiplayer { ); element.set('position', { x: data.x, y: data.y }); // Trigger a rendering of the element on the paper - paper.findViewByModel(element).update(); + await paper.findViewByModel(element).update(); + // validate if the parent pool was updated + await element.component.$nextTick(); + await this.modeler.paperManager.awaitScheduledUpdates(); + if (newPool && element.component.node.pool && element.component.node.pool.component.id !== data.poolId) { + element.component.node.pool.component.moveElementRemote(element, newPool); + } } addFlow(data) {