From 60f80682c5303b213859a954d4d43c9e3b460aee Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Wed, 5 Aug 2026 19:25:17 +0000 Subject: [PATCH] Collapse duplicate proto nodes when assigning stable ids --- node-graph/graph-craft/src/proto.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node-graph/graph-craft/src/proto.rs b/node-graph/graph-craft/src/proto.rs index 2d922e1b1f..d1c40cb725 100644 --- a/node-graph/graph-craft/src/proto.rs +++ b/node-graph/graph-craft/src/proto.rs @@ -258,6 +258,11 @@ impl ProtoNetwork { self.replace_node_id(&outwards_edges, NodeId(index as u64), sni); self.nodes[index].0 = sni; } + + // Equal nodes hash to one id; the copies must go, or a pass that + // rewrites one of them (like adapter splicing) leaves the others stale. + let mut seen = HashSet::new(); + self.nodes.retain(|(id, _)| seen.insert(*id)); } // TODO: Remove