Skip to content

Commit 2212dcb

Browse files
committed
suspense -> unstable_suspense
1 parent 574d900 commit 2212dcb

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

packages/next/shared/lib/dynamic.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type LoadableBaseOptions<P = {}> = LoadableGeneratedOptions & {
3434
| React.LazyExoticComponent<React.ComponentType<P>>
3535
loadableGenerated?: LoadableGeneratedOptions
3636
ssr?: boolean
37-
suspense?: boolean
37+
unstable_suspense?: boolean
3838
}
3939

4040
export type LoadableOptions<P = {}> = LoadableBaseOptions<P>
@@ -115,25 +115,25 @@ export default function dynamic<P = {}>(
115115
if (!process.env.__NEXT_REACT_ROOT) {
116116
if (
117117
process.env.NODE_ENV !== 'production' &&
118-
loadableOptions.suspense &&
118+
loadableOptions.unstable_suspense &&
119119
!isServerSide
120120
) {
121121
console.warn(
122122
`Enable experimental.reactRoot or use React version above 18 to use suspense option`
123123
)
124124
}
125-
loadableOptions.suspense = false
125+
loadableOptions.unstable_suspense = false
126126
}
127127

128-
const { suspense, loader } = loadableOptions
129-
// If suspense is enabled, delegate rendering to suspense
130-
if (suspense) {
128+
const { unstable_suspense, loader } = loadableOptions
129+
// If unstable_suspense is enabled, delegate rendering to unstable_suspense
130+
if (unstable_suspense) {
131131
delete loadableOptions.loadableGenerated
132132
delete loadableOptions.loading
133133
delete loadableOptions.ssr
134134
}
135135

136-
if (typeof loadableOptions.loader === 'function' && suspense) {
136+
if (typeof loadableOptions.loader === 'function' && unstable_suspense) {
137137
loadableOptions.loader = React.lazy(
138138
loader as () => Promise<{
139139
default: React.ComponentType<P>
@@ -150,7 +150,7 @@ export default function dynamic<P = {}>(
150150
}
151151

152152
// support for disabling server side rendering, eg: dynamic(import('../hello-world'), {ssr: false})
153-
if (loadableOptions.ssr === false && !suspense) {
153+
if (loadableOptions.ssr === false && !unstable_suspense) {
154154
return noSSR(loadableFn, loadableOptions)
155155
}
156156

packages/next/shared/lib/loadable.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,14 @@ function createLoadableComponent(loadFn, options) {
6666
timeout: null,
6767
webpack: null,
6868
modules: null,
69-
suspense: false,
69+
unstable_suspense: false,
7070
},
7171
options
7272
)
7373

74+
opts.suspense = opts.unstable_suspense
75+
delete opts.unstable_suspense
76+
7477
let subscription = null
7578
function init() {
7679
if (opts.suspense) {

0 commit comments

Comments
 (0)