Move SuspenseList to experimental package (#17130)
Also moves `withSuspenseConfig`
Andrew Clark committed
Oct 18, 2019 at 14:24 UTC
c47f59331ee94b1d04f974f075373d368a8c8ab3
9 files changed
+47
-9
packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
+1
-1
@@ -85,7 +85,7 @@ describe('ReactDOMServerPartialHydration', () => {
85
ReactDOMServer = require('react-dom/server');
86
Scheduler = require('scheduler');
87
Suspense = React.Suspense;
88
- SuspenseList = React.unstable_SuspenseList;
88
+ SuspenseList = React.SuspenseList;
89
90
useHover = require('react-interactions/events/hover').useHover;
91
});
packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js
+2
-2
@@ -107,14 +107,14 @@ describe('ReactDOMServerSuspense', () => {
107
108
it('server renders a SuspenseList component and its children', async () => {
109
const example = (
110
- <React.unstable_SuspenseList>
110
+ <React.SuspenseList>
111
<React.Suspense fallback="Loading A">
112
<div>A</div>
113
</React.Suspense>
114
<React.Suspense fallback="Loading B">
115
<div>B</div>
116
</React.Suspense>
117
- </React.unstable_SuspenseList>
117
+ </React.SuspenseList>
118
);
119
const element = await serverRender(example);
120
const parent = element.parentNode;
packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js
+1
-1
@@ -724,7 +724,7 @@ function runActTests(label, render, unmount, rerender) {
724
});
725
726
describe('suspense', () => {
727
- if (__DEV__) {
727
+ if (__DEV__ && __EXPERIMENTAL__) {
728
it('triggers fallbacks if available', async () => {
729
let resolved = false;
730
let resolve;
packages/react-reconciler/src/__tests__/ReactSuspenseList-test.internal.js
+6
-1
@@ -6,6 +6,11 @@ let Suspense;
6
let SuspenseList;
7
8
describe('ReactSuspenseList', () => {
9
+ if (!__EXPERIMENTAL__) {
10
+ it("empty test so Jest doesn't complain", () => {});
11
+ return;
12
+ }
13
+
14
beforeEach(() => {
15
jest.resetModules();
16
ReactFeatureFlags = require('shared/ReactFeatureFlags');
@@ -16,7 +21,7 @@ describe('ReactSuspenseList', () => {
21
ReactNoop = require('react-noop-renderer');
22
Scheduler = require('scheduler');
23
Suspense = React.Suspense;
19
- SuspenseList = React.unstable_SuspenseList;
24
+ SuspenseList = React.SuspenseList;
25
});
26
27
function Text(props) {
packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js
+5
@@ -10,6 +10,11 @@ let TextResource;
10
let textResourceShouldFail;
11
12
describe('ReactSuspenseWithNoopRenderer', () => {
13
+ if (!__EXPERIMENTAL__) {
14
+ it("empty test so Jest doesn't complain", () => {});
15
+ return;
16
+ }
17
+
18
beforeEach(() => {
19
jest.resetModules();
20
ReactFeatureFlags = require('shared/ReactFeatureFlags');
packages/react/index.fb.js
new
+14
@@ -0,0 +1,14 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+'use strict';
9
+
10
+const ReactFB = require('./src/ReactFB');
11
+
12
+// TODO: decide on the top-level export form.
13
+// This is hacky but makes it work with both Rollup and Jest.
14
+module.exports = ReactFB.default || ReactFB;
packages/react/src/React.js
+2
-3
@@ -96,7 +96,6 @@ const React = {
96
Profiler: REACT_PROFILER_TYPE,
97
StrictMode: REACT_STRICT_MODE_TYPE,
98
Suspense: REACT_SUSPENSE_TYPE,
99
- unstable_SuspenseList: REACT_SUSPENSE_LIST_TYPE,
99
100
createElement: __DEV__ ? createElementWithValidation : createElement,
101
cloneElement: __DEV__ ? cloneElementWithValidation : cloneElement,
@@ -105,14 +104,14 @@ const React = {
104
105
version: ReactVersion,
106
108
- unstable_withSuspenseConfig: withSuspenseConfig,
109
-
107
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals,
108
};
109
110
if (exposeConcurrentModeAPIs) {
111
React.useTransition = useTransition;
112
React.useDeferredValue = useDeferredValue;
113
+ React.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
114
+ React.unstable_withSuspenseConfig = withSuspenseConfig;
115
}
116
117
if (enableFlareAPI) {
packages/react/src/ReactFB.js
new
+15
@@ -0,0 +1,15 @@
1
+/**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ */
9
+
10
+import React from './React';
11
+
12
+// TODO: Temporary alias until we update the callers downstream.
13
+React.unstable_SuspenseList = React.SuspenseList;
14
+
15
+export default React;
packages/react/src/__tests__/ReactDOMTracing-test.internal.js
+1
-1
@@ -523,7 +523,7 @@ describe('ReactDOMTracing', () => {
523
});
524
525
it('should properly trace interactions through a multi-pass SuspenseList render', () => {
526
- const SuspenseList = React.unstable_SuspenseList;
526
+ const SuspenseList = React.SuspenseList;
527
const Suspense = React.Suspense;
528
function Text({text}) {
529
Scheduler.unstable_yieldValue(text);