Skip to content

Commit

Permalink
disable unused next/dynamic walking in app dir (vercel#59338)
Browse files Browse the repository at this point in the history
### What?

remove expensive unused code


Closes PACK-2108
  • Loading branch information
sokra authored Dec 6, 2023
1 parent 34e9d65 commit 99b9304
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions packages/next-swc/crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use next_core::{
next_client_reference::{
ClientReferenceGraph, ClientReferenceType, NextEcmascriptClientReferenceTransition,
},
next_dynamic::{NextDynamicEntries, NextDynamicTransition},
next_dynamic::NextDynamicTransition,
next_edge::route_regex::get_named_middleware_regex,
next_manifests::{
AppBuildManifest, AppPathsManifest, BuildManifest, ClientReferenceManifest,
Expand Down Expand Up @@ -584,30 +584,31 @@ impl AppEndpoint {
let client_reference_types = client_reference_graph.types();
let client_references = client_reference_graph.entry(rsc_entry_asset);

let app_ssr_entries: Vec<_> = client_reference_types
.await?
.iter()
.map(|client_reference_ty| async move {
let ClientReferenceType::EcmascriptClientReference(entry) = client_reference_ty
else {
return Ok(None);
};

Ok(Some(entry.await?.ssr_module))
})
.try_join()
.await?
.into_iter()
.flatten()
.collect();

let app_node_entries: Vec<_> = app_ssr_entries.iter().copied().chain([rsc_entry]).collect();

// TODO(alexkirsz) Handle dynamic entries and dynamic chunks.
let _dynamic_entries = NextDynamicEntries::from_entries(Vc::cell(
app_node_entries.iter().copied().map(Vc::upcast).collect(),
))
.await?;
// let app_ssr_entries: Vec<_> = client_reference_types
// .await?
// .iter()
// .map(|client_reference_ty| async move {
// let ClientReferenceType::EcmascriptClientReference(entry) =
// client_reference_ty else {
// return Ok(None);
// };

// Ok(Some(entry.await?.ssr_module))
// })
// .try_join()
// .await?
// .into_iter()
// .flatten()
// .collect();

// let app_node_entries: Vec<_> =
// app_ssr_entries.iter().copied().chain([rsc_entry]).collect();

// let _dynamic_entries = NextDynamicEntries::from_entries(Vc::cell(
// app_node_entries.iter().copied().map(Vc::upcast).collect(),
// ))
// .await?;

let app_entry_client_references = client_reference_graph
.entry(Vc::upcast(app_entry.rsc_entry))
Expand Down

0 comments on commit 99b9304

Please sign in to comment.