diff --git a/crates/next-core/src/next_client_reference/visit_client_reference.rs b/crates/next-core/src/next_client_reference/visit_client_reference.rs index 3954f7a6a4d37..a6991b0187a18 100644 --- a/crates/next-core/src/next_client_reference/visit_client_reference.rs +++ b/crates/next-core/src/next_client_reference/visit_client_reference.rs @@ -95,7 +95,7 @@ impl Default for ClientReferenceGraphResult { } } -#[turbo_tasks::value(shared, local)] +#[turbo_tasks::value(shared)] pub struct VisitedClientReferenceGraphNodes(HashSet); #[turbo_tasks::value_impl] @@ -169,11 +169,11 @@ pub async fn client_reference_graph( .await? { VisitClientReferenceNodeState::InServerComponent { - server_component: *server_component, + server_component, } } else { VisitClientReferenceNodeState::Entry { - entry_path: module.ident().path().resolve().await?, + entry_path: module.ident().path().to_resolved().await?, } }, ty: VisitClientReferenceNodeType::Internal( @@ -244,7 +244,7 @@ pub struct ServerEntries { #[turbo_tasks::function] pub async fn find_server_entries(entry: ResolvedVc>) -> Result> { - let entry_path = entry.ident().path().resolve().await?; + let entry_path = entry.ident().path().to_resolved().await?; let graph = AdjacencyMap::new() .skip_duplicates() .visit( @@ -288,7 +288,16 @@ struct VisitClientReference { } #[derive( - Clone, Eq, PartialEq, Hash, Serialize, Deserialize, Debug, ValueDebugFormat, TraceRawVcs, + Clone, + Eq, + PartialEq, + Hash, + Serialize, + Deserialize, + Debug, + ValueDebugFormat, + TraceRawVcs, + NonLocalValue, )] struct VisitClientReferenceNode { state: VisitClientReferenceNodeState, @@ -296,19 +305,29 @@ struct VisitClientReferenceNode { } #[derive( - Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize, Debug, ValueDebugFormat, TraceRawVcs, + Clone, + Copy, + Eq, + PartialEq, + Hash, + Serialize, + Deserialize, + Debug, + ValueDebugFormat, + TraceRawVcs, + NonLocalValue, )] enum VisitClientReferenceNodeState { Entry { - entry_path: Vc, + entry_path: ResolvedVc, }, InServerComponent { - server_component: Vc, + server_component: ResolvedVc, }, InServerUtil, } impl VisitClientReferenceNodeState { - fn server_component(&self) -> Option> { + fn server_component(&self) -> Option> { match self { VisitClientReferenceNodeState::Entry { .. } => None, VisitClientReferenceNodeState::InServerComponent { server_component } => { @@ -389,12 +408,7 @@ impl Visit for VisitClientReference { state: node.state, ty: VisitClientReferenceNodeType::ClientReference( ClientReference { - server_component: match node.state.server_component() { - Some(server_component) => { - Some(server_component.to_resolved().await?) - } - None => None, - }, + server_component: node.state.server_component(), ty: ClientReferenceType::EcmascriptClientReference { parent_module, module: client_reference_module, @@ -412,12 +426,7 @@ impl Visit for VisitClientReference { state: node.state, ty: VisitClientReferenceNodeType::ClientReference( ClientReference { - server_component: match node.state.server_component() { - Some(server_component) => { - Some(server_component.to_resolved().await?) - } - None => None, - }, + server_component: node.state.server_component(), ty: ClientReferenceType::CssClientReference( css_client_reference_asset, ), @@ -432,7 +441,7 @@ impl Visit for VisitClientReference { { return Ok(VisitClientReferenceNode { state: VisitClientReferenceNodeState::InServerComponent { - server_component: *server_component_asset, + server_component: server_component_asset, }, ty: VisitClientReferenceNodeType::ServerComponentEntry( server_component_asset,