Unverified Commit 62267ec7 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

remove legacy handling for suspense option of next/dynamic (#57900)

This part was removed before but added in back during the merging of turbopack and legacy `next-swc` changes. Remove them again
parent 337f33b3
...@@ -326,7 +326,6 @@ impl Fold for NextDynamicPatcher { ...@@ -326,7 +326,6 @@ impl Fold for NextDynamicPatcher {
})))]; })))];
let mut has_ssr_false = false; let mut has_ssr_false = false;
let mut has_suspense = false;
if expr.args.len() == 2 { if expr.args.len() == 2 {
if let Expr::Object(ObjectLit { if let Expr::Object(ObjectLit {
...@@ -359,15 +358,6 @@ impl Fold for NextDynamicPatcher { ...@@ -359,15 +358,6 @@ impl Fold for NextDynamicPatcher {
has_ssr_false = true has_ssr_false = true
} }
} }
if sym == "suspense" {
if let Some(Lit::Bool(Bool {
value: true,
span: _,
})) = value.as_lit()
{
has_suspense = true
}
}
} }
} }
} }
...@@ -375,17 +365,10 @@ impl Fold for NextDynamicPatcher { ...@@ -375,17 +365,10 @@ impl Fold for NextDynamicPatcher {
} }
} }
// Don't strip the `loader` argument if suspense is true
// See https://github.com/vercel/next.js/issues/36636 for background.
// Also don't strip the `loader` argument for server components (both // Also don't strip the `loader` argument for server components (both
// server/client layers), since they're aliased to a // server/client layers), since they're aliased to a
// React.lazy implementation. // React.lazy implementation.
if has_ssr_false if has_ssr_false && self.is_server_compiler && !self.is_react_server_layer {
&& !has_suspense
&& self.is_server_compiler
&& !self.is_react_server_layer
{
expr.args[0] = Lit::Null(Null { span: DUMMY_SP }).as_arg(); expr.args[0] = Lit::Null(Null { span: DUMMY_SP }).as_arg();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment