Blazor-Diagrams / Blazor.Diagrams

A fully customizable and extensible all-purpose diagrams library for Blazor
https://blazor-diagrams.zhaytam.com
MIT License
919 stars 176 forks source link

Demo site diagram "Add"-node allowing connection to itself, blocking the diagram with refreshs #365

Open K0369 opened 8 months ago

K0369 commented 8 months ago

On the demo site, it is possible to link the result of an "Add-node" with it's own input. Since the "OnValueChange" contains a call to the nodes Refresh-Method, and the Refresh-Method updates the value, which invokes "OnValueChange", this results in a neverending loop of updating and refreshing.

A quick and dirty solution for this could be to check in the Calculator-Ports "CanAttach"-Method if the own parent Model and the target Model are the same instance, although this doesn't stop a user from being able to draw a closed loop over two Add-Nodes.

Another solution might be to rework the updating to check for recursive values.

And a third solution would be to just let it be as it is, because it is just a small demonstration and if a user draws a recursive graph, it's his own fault for doing so