From aebbf2990fa038c021d2f5e47f8e748876731d59 Mon Sep 17 00:00:00 2001 From: Brit Myers Date: Thu, 19 Dec 2024 22:24:02 -0500 Subject: [PATCH] fix(dal): The order in which we process dependencies between components is inconsistent, so we must always check if the component is in the dependency graph before adding it as Petgraph doesn't prevent nodes with duplicate node weights from being inserted --- lib/dal/src/action/dependency_graph.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/dal/src/action/dependency_graph.rs b/lib/dal/src/action/dependency_graph.rs index 83709999bd..8b1a5fe153 100644 --- a/lib/dal/src/action/dependency_graph.rs +++ b/lib/dal/src/action/dependency_graph.rs @@ -86,8 +86,10 @@ impl ActionDependencyGraph { // things they are feeding data into. for component_id in actions_by_component_id.keys().copied() { let component = Component::get_by_id(ctx, component_id).await?; - let component_index = component_dependencies.add_node(component_id); - component_dependencies_index_by_id.insert(component_id, component_index); + let component_index = component_dependencies_index_by_id + .entry(component_id) + .or_insert_with(|| component_dependencies.add_node(component_id)) + .to_owned(); for incoming_connection in component.incoming_connections(ctx).await? { component_dependencies_index_by_id .entry(incoming_connection.from_component_id)