From 79380ce5551304ddf60c3b33613c314f500bd806 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:08:17 +0100 Subject: [PATCH] Use `iter_nodes` instead --- crates/next-api/src/module_graph.rs | 6 ++++++ crates/next-api/src/server_actions.rs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/next-api/src/module_graph.rs b/crates/next-api/src/module_graph.rs index b67b2a32b415a0..47f26e6a852996 100644 --- a/crates/next-api/src/module_graph.rs +++ b/crates/next-api/src/module_graph.rs @@ -319,6 +319,12 @@ impl SingleModuleGraph { .context("Couldn't find entry module in graph") } + /// Iterate over all nodes in the graph (potentially in the whole app!). + pub fn iter_nodes(&self) -> impl Iterator + '_ { + self.graph.node_weights() + } + + /// Enumerate over all nodes in the graph (potentially in the whole app!). pub fn enumerate_nodes( &self, ) -> impl Iterator + '_ { diff --git a/crates/next-api/src/server_actions.rs b/crates/next-api/src/server_actions.rs index 2b33bb5dd2e2a2..7b63b183f1305f 100644 --- a/crates/next-api/src/server_actions.rs +++ b/crates/next-api/src/server_actions.rs @@ -397,8 +397,8 @@ pub struct AllModuleActions(HashMap>, LayerAndActions pub async fn map_server_actions(graph: Vc) -> Result> { let actions = graph .await? - .enumerate_nodes() - .map(|(_, node)| { + .iter_nodes() + .map(|node| { async move { // TODO: compare module contexts instead? let layer = match &node.layer {