This is an automated email from the ASF dual-hosted git repository.
thiagoelg pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new f71e935c010 kie-issues#2297: BPMN Editor: Creating new edges on
existing edges from and to gateway nodes causes issues (#3571)
f71e935c010 is described below
commit f71e935c010ce43d8c745d1b4dafa70dac440ebe
Author: Aswathi <[email protected]>
AuthorDate: Tue May 12 17:07:02 2026 +0530
kie-issues#2297: BPMN Editor: Creating new edges on existing edges from and
to gateway nodes causes issues (#3571)
---
packages/bpmn-editor/src/mutations/addEdge.ts | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/packages/bpmn-editor/src/mutations/addEdge.ts
b/packages/bpmn-editor/src/mutations/addEdge.ts
index 1ffc80d6b5d..2cf7b6b41e4 100644
--- a/packages/bpmn-editor/src/mutations/addEdge.ts
+++ b/packages/bpmn-editor/src/mutations/addEdge.ts
@@ -80,7 +80,7 @@ export function addEdge({
);
}
- const newEdgeId = generateUuid();
+ let newEdgeId = generateUuid();
const { process, diagramElements } = addOrGetProcessAndDiagramElements({
definitions });
@@ -130,12 +130,13 @@ export function addEdge({
(a) => a.__$$element === "sequenceFlow" && areEdgesEquivalent(a,
newSequenceFlow)
);
existingEdgeId = removed?.["@_id"];
+ newEdgeId = tryKeepingEdgeId(existingEdgeId, newEdgeId);
// Replace with the new one.
process.flowElement?.push({
__$$element: "sequenceFlow",
...newSequenceFlow,
- "@_id": tryKeepingEdgeId(existingEdgeId, newEdgeId),
+ "@_id": newEdgeId,
});
}
@@ -151,6 +152,15 @@ export function addEdge({
element.__$$element !== "dataObjectReference"
) {
if (__readonly_edge.type === EDGE_TYPES.sequenceFlow) {
+ // Clean up old edge references from all nodes when replacing an edge
+ if (existingEdgeId) {
+ if (element.outgoing) {
+ element.outgoing = element.outgoing.filter((o) => o.__$$text !==
existingEdgeId);
+ }
+ if (element.incoming) {
+ element.incoming = element.incoming.filter((o) => o.__$$text !==
existingEdgeId);
+ }
+ }
// outgoing
if (element["@_id"] === __readonly_sourceNode.href) {
element.outgoing ??= [];
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]