Skip to content

Validation Inifinite Loop when cascading values through nodes #105

@ryancoopers

Description

@ryancoopers

If you create a node that basically passes an input to an output it seems you can get yourself stuck in a loop that has something to do with validation. For instance in this code: if you connect Node A's output to Node B's input everything is fine, but if you then disconnect those two nodes and instead connect Node B's output to Node A's input you get stuck in a loop and the UI becomes unresponsive. Is this a known constraint/issue, or am I missing something?

public class Test : NodeViewModel
    {
        public ValueNodeInputViewModel<string> Input { get; }
        public ValueNodeOutputViewModel<string> Output { get; }

        static Test()
        {
            Splat.Locator.CurrentMutable.Register(() => new NodeView(), typeof(IViewFor<Test>));
        }

        public Test(string name)
        {
            Name = name;

            Input = new ValueNodeInputViewModel<string>()
            {
                Name = "Input"
            };
            Inputs.Add(Input);

            Output = new ValueNodeOutputViewModel<string>()
            {
                Name = "Output",
                Value = this.WhenAnyObservable(vm => vm.Input.ValueChanged)
            };
            Outputs.Add(Output);
        }
    }

    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            var network = new NetworkViewModel();

            var test = new Test(@"Node A");
            network.Nodes.Add(test);

            var test2 = new Test(@"Node B");
            network.Nodes.Add(test2);  
            
            networkView.ViewModel = network;
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions