adrai / flowchart.js

Draws simple SVG flow chart diagrams from textual representation of the diagram
http://flowchart.js.org/
MIT License
8.49k stars 1.21k forks source link

Maxcallstack exceeded issue #231

Open nebuchenazarr opened 2 years ago

nebuchenazarr commented 2 years ago

Hi there, i've run into an issue where an infinite loop happens and maximum call stack exceeded ends up being called. I've simplified the chart to the minimum to replicate the issue :

start=>start: Start op1=>operation: Operation 1 cond2=>condition: Condition 2 cond3=>condition: Condition 3 cond4=>condition: Condition 4 op5=>operation: Operation 5 op6=>operation: Operation 6 end=>end: End start->op1 op1->cond2 cond2(yes)->cond3 cond2(no,left)->op5 cond3(yes,right)->cond4 cond3(no)->op6 cond4(yes)->cond2 cond4(no)->end

cond4(yes)->cond2 is the culprit, removing cond2 makes the chart resolve fine. From what the console.logs could tell me it looks like it loops Condition 2, Condition 3 and Condition 4 in sequence indefinitely. If i change one condition 2 or 3 to an operation it does not do it anymore. I suspect it might have to do with having 3 conditions in a row (plus trying to route yes to cond2)?

Also if i swap the targets for no/yes for cond4 it works as well.

Thanks and good day

adrai commented 2 years ago

Would you like to send a Pull Request to address this?