Resolved save load issues for the nodes by chaning the unique node id to guid
Some checks failed
Build / build (push) Has been cancelled

This commit is contained in:
Ankitkumar Satapara
2026-04-21 20:03:58 +05:30
parent c58ce5d71d
commit e698f18ad9
2 changed files with 5 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
@@ -85,7 +86,7 @@ namespace Nodify.Calculator
Operations.WhenAdded(x =>
{
x.Input.WhenRemoved(RemoveConnection);
if (!IsLoading) x.NodeId = (Operations.Count + 1).ToString();
if (!IsLoading) x.NodeId = Guid.NewGuid().ToString("N");
Debug.WriteLine($"Currently adding the node with node id : {x.NodeId} , Title : {x.Title}");
if (x is CalculatorInputOperationViewModel ci)
{

View File

@@ -16,12 +16,11 @@ namespace Nodify.Calculator
var operations = calculator.Operations;
var connections = calculator.Connections;
// Ensure all nodes have IDs
int idCounter = 1;
// Ensure all nodes have unique IDs
foreach (var op in operations)
{
if (string.IsNullOrEmpty(op.NodeId))
op.NodeId = $"node_{idCounter++}";
op.NodeId = Guid.NewGuid().ToString("N");
}
// Serialize nodes