mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-14 19:25:06 +08:00
fix(modeling): do not duplicate flow node refs
Closes: https://github.com/camunda/camunda-modeler/issues/1504
This commit is contained in:
@ -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 [ ... ];
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user