Skip to content

Commit

Permalink
Use iter_nodes instead
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Dec 10, 2024
1 parent 43e01db commit 79380ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions crates/next-api/src/module_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = &'_ SingleModuleGraphNode> + '_ {
self.graph.node_weights()
}

/// Enumerate over all nodes in the graph (potentially in the whole app!).
pub fn enumerate_nodes(
&self,
) -> impl Iterator<Item = (NodeIndex, &'_ SingleModuleGraphNode)> + '_ {
Expand Down
4 changes: 2 additions & 2 deletions crates/next-api/src/server_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ pub struct AllModuleActions(HashMap<ResolvedVc<Box<dyn Module>>, LayerAndActions
pub async fn map_server_actions(graph: Vc<SingleModuleGraph>) -> Result<Vc<AllModuleActions>> {
let actions = graph
.await?
.enumerate_nodes()
.map(|(_, node)| {
.iter_nodes()
.map(|node| {
async move {
// TODO: compare module contexts instead?
let layer = match &node.layer {
Expand Down

0 comments on commit 79380ce

Please sign in to comment.