fix(modeling): do not duplicate flow node refs

Closes: https://github.com/camunda/camunda-modeler/issues/1504
This commit is contained in:
Philipp Fromme
2019-10-09 10:32:27 +02:00
parent 37bcd070e8
commit 168a1493b2
3 changed files with 79 additions and 22 deletions

View File

@ -34,7 +34,7 @@ UpdateFlowNodeRefsHandler.$inject = [
UpdateFlowNodeRefsHandler.prototype.computeUpdates = function(flowNodeShapes, laneShapes) {
var handledNodes = {};
var handledNodes = [];
var updates = [];
@ -58,9 +58,9 @@ UpdateFlowNodeRefsHandler.prototype.computeUpdates = function(flowNodeShapes, la
}
function addFlowNodeShape(flowNodeShape) {
if (!handledNodes[flowNodeShape.id]) {
if (handledNodes.indexOf(flowNodeShape) === -1) {
allFlowNodeShapes.push(flowNodeShape);
handledNodes[flowNodeShape.id] = flowNodeShape;
handledNodes.push(flowNodeShape);
}
}
@ -92,7 +92,7 @@ UpdateFlowNodeRefsHandler.prototype.computeUpdates = function(flowNodeShapes, la
laneShapes.forEach(function(laneShape) {
var root = getLanesRoot(laneShape);
if (!root || handledNodes[root.id]) {
if (!root || handledNodes.indexOf(root) !== -1) {
return;
}
@ -102,7 +102,7 @@ UpdateFlowNodeRefsHandler.prototype.computeUpdates = function(flowNodeShapes, la
children.forEach(addFlowNodeShape);
handledNodes[root.id] = root;
handledNodes.push(root);
});
flowNodeShapes.forEach(addFlowNodeShape);
@ -190,4 +190,4 @@ UpdateFlowNodeRefsHandler.prototype.revert = function(context) {
// TODO(nikku): return changed elements
// return [ ... ];
};
};