I've encountered an issue with the following code where I am struggling to break the loop under certain conditions.
Desired Outcome: An error message should display, allowing the user to close it and remove the escalation node correctly.
Actual Outcome: The user is unable to manually dismiss the error message by clicking 'ok'; it disappears on its own after a few minutes.
public findVerticesBelow(vertexId: number) {
// debugger
this.recussionTime++;
if(this.recussionTime <= 150){
console.log(this.recussionTime)
if (!this.vertexIdList.includes(vertexId)) {
this.vertexIdList.push(vertexId)
}
let tempvertexIdList: Array<number> = new Array<number>();
this.edges.forEach(edge => {
if (edge.fromId == vertexId) {
tempvertexIdList.push(edge.toId);
}
})
tempvertexIdList.forEach(tempvertexId => {
this.findVerticesBelow(tempvertexId)
});
}else{
// debugger
console.log("AAAAAAAAAAAAAAA")
// alert("You are having a recursive loop please remove it before trying to remove nodes")
// alert("ASCDFVGBHN")
}
}
My goal is to terminate the loop and return a boolean value, but my current attempts have been unsuccessful. Can anyone offer assistance?