Blazor.Diagrams icon indicating copy to clipboard operation
Blazor.Diagrams copied to clipboard

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

Open K0369 opened this issue 1 year ago • 0 comments

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

K0369 avatar Oct 16 '23 10:10 K0369