fix: 解决存在循环节点时的bug

This commit is contained in:
Lesan 2024-11-25 02:14:21 +00:00 committed by Gitee
parent 00a19cfc78
commit e587d68fef
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -245,6 +245,7 @@ function findAllPredecessorsExcludingStart(elementId, modeler) {
const elementRegistry = modeler.get('elementRegistry') const elementRegistry = modeler.get('elementRegistry')
const allConnections = elementRegistry.filter((element) => element.type === 'bpmn:SequenceFlow') const allConnections = elementRegistry.filter((element) => element.type === 'bpmn:SequenceFlow')
const predecessors = new Set() // 使 Set const predecessors = new Set() // 使 Set
const visited = new Set() // 访
// //
function isStartEvent(element) { function isStartEvent(element) {
@ -252,6 +253,14 @@ function findAllPredecessorsExcludingStart(elementId, modeler) {
} }
function findPredecessorsRecursively(element) { function findPredecessorsRecursively(element) {
// 访
if (visited.has(element)) {
return
}
// 访
visited.add(element)
// //
const incomingConnections = allConnections.filter((connection) => connection.target === element) const incomingConnections = allConnections.filter((connection) => connection.target === element)