jomarko commented on code in PR #4045:
URL: 
https://github.com/apache/incubator-kie-tools/pull/4045#discussion_r4269471516


##########
packages/bpmn-editor/src/mutations/renameGlobalProperties.ts:
##########
@@ -39,4 +39,12 @@ export function updateProcessId({
       participant["@_processRef"] = newId;
     }
   }
+
+  // Keep the DI layer in sync, otherwise BPMNPlane.bpmnElement becomes a 
dangling IDREF.
+  definitions["bpmndi:BPMNDiagram"]?.forEach((diagram) => {
+    const plane = diagram["bpmndi:BPMNPlane"];
+    if (plane["@_bpmnElement"] === oldProcessId) {
+      plane["@_bpmnElement"] = newId;
+    }

Review Comment:
   The plane is a single required element in the schema-generated types and 
`addOrGetProcessAndDiagramElements` already relies on it. 
   
   This is from 
`packages/bpmn-marshaller/dist/schemas/bpmn-2_0/ts-gen/types.d.ts`
   
   <img width="484" height="138" alt="image" 
src="https://github.com/user-attachments/assets/fb7ce145-b92d-42e2-b360-f09390da842c";
 />
   
   I am updating the codebase only in the following way:
   ```
   definitions["bpmndi:BPMNDiagram"]?.forEach((diagram) => {
       const plane = diagram["bpmndi:BPMNPlane"];
       if (plane?.["@_bpmnElement"] === oldProcessId) {
         plane["@_bpmnElement"] = newId;
       }
     });
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to