onActionBlockRemoved method

void onActionBlockRemoved(
  1. String actionBlockKey
)

Update the graph when an action block is removed.

Removes the action block node and cleans up any orphan dependency nodes.

Implementation

void onActionBlockRemoved(String actionBlockKey) {
  final nodeId = NodeIds.actionBlock(actionBlockKey);
  final node = graph.getNode(nodeId);
  if (node == null) return;

  // Track granular nodes that might become orphans
  final granularImports =
      node.imports.where(NodeIds.isGranularDependencyNodeId).toList();

  // Remove the node (this also removes all edges)
  graph.removeNode(nodeId);

  // Clean up orphan granular dependency nodes
  for (final depNodeId in granularImports) {
    graph.removeIfOrphan(depNodeId);
  }
}