I have a the below code, on which i am unable to break the loop on certain conditions.
Expected Result : Error message should appear and user should be able to close the message and remove the escalation node properly
Actual Result : User Cannot remove the Error message by clicking ok..it automatically disappear within several 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")
}
}
I want to break the code and return the boolean value, but I am unable to do it right now. Can anybody help me.