rename SuspenseList export to unstable_SuspenseList (#27061)
## Summary as we began [discussing yesterday](https://github.com/facebook/react/pull/27056#discussion_r1253282784), `SuspenseList` is not actually stable yet, and should likely be exported with the `unstable_` prefix. the conversation yesterday began discussing this in the context of the fb-specific packages, but changing it there without updating everywhere else leads to test failures, so here the change is made across packages. ## How did you test this change? ``` yarn flow dom-browser yarn test ```
Noah Lemen committed
Jul 6, 2023 at 14:09 UTC
eb2c2f7c2cf2652a168c2b433d2989131c69754b
18 files changed
+24
-21
fixtures/stacks/Example.js
+1
-1
@@ -38,7 +38,7 @@ function Example() {
38
DisplayName,
39
null,
40
x(
41
- React.SuspenseList,
41
+ React.unstable_SuspenseList,
42
null,
43
x(
44
NativeClass,
packages/react-devtools-shared/src/__tests__/store-test.js
+2
-2
@@ -693,13 +693,13 @@ describe('Store', () => {
693
};
694
const Wrapper = ({shouldSuspense}) => (
695
<React.Fragment>
696
- <React.SuspenseList revealOrder="forwards" tail="collapsed">
696
+ <React.unstable_SuspenseList revealOrder="forwards" tail="collapsed">
697
<Component key="A" />
698
<React.Suspense fallback={<Loading />}>
699
{shouldSuspense ? <SuspendingComponent /> : <Component key="B" />}
700
</React.Suspense>
701
<Component key="C" />
702
- </React.SuspenseList>
702
+ </React.unstable_SuspenseList>
703
</React.Fragment>
704
);
705
packages/react-devtools-shell/src/app/SuspenseTree/index.js
+6
-1
@@ -8,7 +8,12 @@
8
*/
9
10
import * as React from 'react';
11
-import {Fragment, Suspense, SuspenseList, useState} from 'react';
11
+import {
12
+ Fragment,
13
+ Suspense,
14
+ unstable_SuspenseList as SuspenseList,
15
+ useState,
16
+} from 'react';
17
18
function SuspenseTree(): React.Node {
19
return (
packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
+1
-1
@@ -81,7 +81,7 @@ describe('ReactDOMFizzServer', () => {
81
Suspense = React.Suspense;
82
use = React.use;
83
if (gate(flags => flags.enableSuspenseList)) {
84
- SuspenseList = React.SuspenseList;
84
+ SuspenseList = React.unstable_SuspenseList;
85
}
86
87
PropTypes = require('prop-types');
packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
+1
-1
@@ -116,7 +116,7 @@ describe('ReactDOMServerPartialHydration', () => {
116
Offscreen = React.unstable_Offscreen;
117
useSyncExternalStore = React.useSyncExternalStore;
118
if (gate(flags => flags.enableSuspenseList)) {
119
- SuspenseList = React.SuspenseList;
119
+ SuspenseList = React.unstable_SuspenseList;
120
}
121
122
const InternalTestUtils = require('internal-test-utils');
packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js
+1
-1
@@ -30,7 +30,7 @@ function initModules() {
30
ReactTestUtils = require('react-dom/test-utils');
31
act = require('internal-test-utils').act;
32
if (gate(flags => flags.enableSuspenseList)) {
33
- SuspenseList = React.SuspenseList;
33
+ SuspenseList = React.unstable_SuspenseList;
34
}
35
36
// Make them available to the helpers.
packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js
+1
-1
@@ -29,7 +29,7 @@ beforeEach(() => {
29
30
Suspense = React.Suspense;
31
if (gate(flags => flags.enableSuspenseList)) {
32
- SuspenseList = React.SuspenseList;
32
+ SuspenseList = React.unstable_SuspenseList;
33
}
34
35
getCacheForType = React.unstable_getCacheForType;
packages/react-is/src/__tests__/ReactIs-test.js
+1
-1
@@ -23,7 +23,7 @@ describe('ReactIs', () => {
23
ReactIs = require('react-is');
24
25
if (gate(flags => flags.enableSuspenseList)) {
26
- SuspenseList = React.SuspenseList;
26
+ SuspenseList = React.unstable_SuspenseList;
27
}
28
});
29
packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js
+1
-1
@@ -23,7 +23,7 @@ describe('ReactLazyContextPropagation', () => {
23
useContext = React.useContext;
24
Suspense = React.Suspense;
25
if (gate(flags => flags.enableSuspenseList)) {
26
- SuspenseList = React.SuspenseList;
26
+ SuspenseList = React.unstable_SuspenseList;
27
}
28
29
const InternalTestUtils = require('internal-test-utils');
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
+1
-1
@@ -67,7 +67,7 @@ describe('ReactHooksWithNoopRenderer', () => {
67
ContinuousEventPriority =
68
require('react-reconciler/constants').ContinuousEventPriority;
69
if (gate(flags => flags.enableSuspenseList)) {
70
- SuspenseList = React.SuspenseList;
70
+ SuspenseList = React.unstable_SuspenseList;
71
}
72
73
const InternalTestUtils = require('internal-test-utils');
packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js
+1
-1
@@ -19,7 +19,7 @@ describe('ReactSuspenseList', () => {
19
Profiler = React.Profiler;
20
Suspense = React.Suspense;
21
if (gate(flags => flags.enableSuspenseList)) {
22
- SuspenseList = React.SuspenseList;
22
+ SuspenseList = React.unstable_SuspenseList;
23
}
24
25
const InternalTestUtils = require('internal-test-utils');
packages/react-reconciler/src/__tests__/ReactSuspenseyCommitPhase-test.js
+1
-1
@@ -21,7 +21,7 @@ describe('ReactSuspenseyCommitPhase', () => {
21
Scheduler = require('scheduler');
22
Suspense = React.Suspense;
23
if (gate(flags => flags.enableSuspenseList)) {
24
- SuspenseList = React.SuspenseList;
24
+ SuspenseList = React.unstable_SuspenseList;
25
}
26
Offscreen = React.unstable_Offscreen;
27
useMemo = React.useMemo;
packages/react/index.classic.fb.js
+1
-2
@@ -17,8 +17,6 @@ export {
17
PureComponent,
18
StrictMode,
19
Suspense,
20
- SuspenseList,
21
- SuspenseList as unstable_SuspenseList, // TODO: Remove once call sights updated to SuspenseList
20
cloneElement,
21
createContext,
22
createElement,
@@ -38,6 +36,7 @@ export {
36
unstable_LegacyHidden,
37
unstable_Offscreen,
38
unstable_Scope,
39
+ unstable_SuspenseList,
40
unstable_getCacheSignal,
41
unstable_getCacheForType,
42
unstable_useCacheRefresh,
packages/react/index.experimental.js
+1
-1
@@ -17,7 +17,6 @@ export {
17
PureComponent,
18
StrictMode,
19
Suspense,
20
- SuspenseList,
20
cloneElement,
21
createContext,
22
createElement,
@@ -36,6 +35,7 @@ export {
35
unstable_Offscreen,
36
unstable_getCacheSignal,
37
unstable_getCacheForType,
38
+ unstable_SuspenseList,
39
unstable_useCacheRefresh,
40
unstable_useMemoCache,
41
useId,
packages/react/index.js
+1
-1
@@ -40,7 +40,6 @@ export {
40
PureComponent,
41
StrictMode,
42
Suspense,
43
- SuspenseList,
43
cloneElement,
44
createContext,
45
createElement,
@@ -59,6 +58,7 @@ export {
58
unstable_LegacyHidden,
59
unstable_Offscreen,
60
unstable_Scope,
61
+ unstable_SuspenseList,
62
unstable_TracingMarker,
63
unstable_getCacheSignal,
64
unstable_getCacheForType,
packages/react/index.modern.fb.js
+1
-2
@@ -17,8 +17,6 @@ export {
17
PureComponent,
18
StrictMode,
19
Suspense,
20
- SuspenseList,
21
- SuspenseList as unstable_SuspenseList, // TODO: Remove once call sights updated to SuspenseList
20
cloneElement,
21
createContext,
22
createElement,
@@ -36,6 +34,7 @@ export {
34
unstable_LegacyHidden,
35
unstable_Offscreen,
36
unstable_Scope,
37
+ unstable_SuspenseList,
38
unstable_getCacheSignal,
39
unstable_getCacheForType,
40
unstable_useCacheRefresh,
packages/react/src/React.js
+1
-1
@@ -130,7 +130,7 @@ export {
130
useTransition,
131
startTransition,
132
useDeferredValue,
133
- REACT_SUSPENSE_LIST_TYPE as SuspenseList,
133
+ REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList,
134
REACT_LEGACY_HIDDEN_TYPE as unstable_LegacyHidden,
135
REACT_OFFSCREEN_TYPE as unstable_Offscreen,
136
getCacheSignal as unstable_getCacheSignal,
packages/react/src/ReactSharedSubset.experimental.js
+1
-1
@@ -17,7 +17,6 @@ export {
17
Profiler,
18
StrictMode,
19
Suspense,
20
- SuspenseList,
20
cloneElement,
21
createElement,
22
createRef,
@@ -30,6 +29,7 @@ export {
29
cache,
30
startTransition,
31
unstable_DebugTracingMode,
32
+ unstable_SuspenseList,
33
unstable_getCacheSignal,
34
unstable_getCacheForType,
35
useId,