rajalakshmys-27 opened a new pull request, #3580: URL: https://github.com/apache/incubator-kie-tools/pull/3580
Closes : [kie-issues#2312](https://github.com/apache/incubator-kie-issues/issues/2312) Drag and drop of subprocesses into other subprocesses was completely broken. Users could not nest subprocesses at any level. **Root Cause** The primary issue was that the containment map in `BpmnDiagramDomain.tsx` was missing `NODE_TYPES.subProcess` in the subprocess containment configuration, preventing the editor from recognizing that subprocesses can contain other subprocesses. Several secondary issues compounded the problem. Mutation functions only searched for subprocesses at the top level of `process.flowElement` rather than traversing nested structures recursively. Diagram rendering used type-based node sorting, which did not guarantee correct parent-child ordering for nested subprocesses. No recursive traversal logic existed to handle multi-level nesting. **Changes** Added `NODE_TYPES.subProcess` to the subprocess containment map, allowing subprocesses to contain other subprocesses in accordance with the BPMN 2.0 specification. Introduced `findSubProcessRecursively()` to locate subprocesses at any nesting depth by traversing the full subprocess tree, and `collectElements()` to gather flow elements from all nesting levels when moving nodes between subprocesses. Replaced type-based node sorting with depth-based sorting so React Flow always processes parent nodes before their children, regardless of nesting depth. **Testing** Verified that subprocesses can be dragged into other subprocesses, that multi-level nesting works at three or more levels, that drag and drop between deeply nested subprocesses functions correctly, that React Flow parent-child relationships are maintained, that BPMN XML document order is preserved, and that no regressions were introduced to existing functionality. <img width="1409" height="383" alt="image" src="https://github.com/user-attachments/assets/27587185-f3ba-42b1-8a15-5029565f70fc" /> <img width="950" height="632" alt="image" src="https://github.com/user-attachments/assets/dc2bf1c4-3b76-4379-b254-8b428744b21a" /> -- 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]
