From e7c5af45ceb8fa2b64d39ec68345254ce9abd65e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?=
Date: Sun, 23 Oct 2022 23:20:52 -0400
Subject: [PATCH] Update cache() and use() to the canary aka next channel
(#25502)
Testing what it would look like to move this to the `next` channel.
---
ReactVersions.js | 8 +-
fixtures/fizz-ssr-browser/index.html | 1 +
fixtures/flight-browser/index.html | 7 +-
fixtures/flight/src/index.js | 2 +-
.../src/__tests__/ReactFlight-test.js | 2 +-
packages/react-dom/index.classic.fb.js | 2 +
packages/react-dom/index.experimental.js | 4 +-
packages/react-dom/index.js | 2 +
packages/react-dom/index.modern.fb.js | 2 +
packages/react-dom/index.stable.js | 2 +
.../server-rendering-stub.experimental.js | 22 ---
packages/react-dom/server-rendering-stub.js | 2 +
.../src/__tests__/ReactDOMFizzServer-test.js | 2 +-
.../src/__tests__/ReactDOMFloat-test.js | 5 +-
.../__tests__/ReactDOMInReactServer-test.js | 1 -
.../__tests__/ReactWrongReturnPointer-test.js | 2 +-
packages/react-dom/src/client/ReactDOM.js | 2 +
.../src/server/ReactDOMServerRenderingStub.js | 2 +
.../src/ReactFiberHooks.new.js | 15 +-
.../src/ReactFiberHooks.old.js | 15 +-
.../src/__tests__/ReactActWarnings-test.js | 4 +-
.../src/__tests__/ReactCache-test.js | 95 ++++++------
.../ReactConcurrentErrorRecovery-test.js | 8 +-
.../__tests__/ReactContextPropagation-test.js | 8 +-
.../src/__tests__/ReactIsomorphicAct-test.js | 2 +-
.../ReactSuspenseEffectsSemantics-test.js | 48 +++---
.../__tests__/ReactSuspenseFallback-test.js | 12 +-
.../ReactSuspenseWithNoopRenderer-test.js | 146 +++++++++---------
.../src/__tests__/ReactThenable-test.js | 2 +-
.../src/__tests__/ReactTransition-test.js | 16 +-
.../react-server-dom-webpack/package.json | 6 +-
.../src/__tests__/ReactFlightDOM-test.js | 2 +-
.../__tests__/ReactFlightDOMBrowser-test.js | 2 +-
packages/react/index.classic.fb.js | 4 +-
packages/react/index.experimental.js | 4 +-
packages/react/index.js | 4 +-
packages/react/index.modern.fb.js | 4 +-
packages/react/index.stable.js | 5 +-
packages/react/src/React.js | 4 +-
.../src/ReactSharedSubset.experimental.js | 4 +-
packages/react/src/ReactSharedSubset.js | 32 +++-
.../react/src/__tests__/ReactFetch-test.js | 7 +-
packages/shared/ReactFeatureFlags.js | 13 +-
.../forks/ReactFeatureFlags.native-fb.js | 9 +-
.../forks/ReactFeatureFlags.native-oss.js | 9 +-
.../forks/ReactFeatureFlags.test-renderer.js | 13 +-
.../ReactFeatureFlags.test-renderer.native.js | 9 +-
.../ReactFeatureFlags.test-renderer.www.js | 9 +-
.../shared/forks/ReactFeatureFlags.testing.js | 9 +-
.../forks/ReactFeatureFlags.testing.www.js | 9 +-
.../shared/forks/ReactFeatureFlags.www.js | 5 +-
51 files changed, 325 insertions(+), 279 deletions(-)
delete mode 100644 packages/react-dom/server-rendering-stub.experimental.js
diff --git a/ReactVersions.js b/ReactVersions.js
index e8dffe7dee1b1..26701175ec3de 100644
--- a/ReactVersions.js
+++ b/ReactVersions.js
@@ -30,6 +30,7 @@ const stablePackages = {
react: ReactVersion,
'react-art': ReactVersion,
'react-dom': ReactVersion,
+ 'react-server-dom-webpack': ReactVersion,
'react-is': ReactVersion,
'react-reconciler': '0.30.0',
'react-refresh': '0.15.0',
@@ -42,12 +43,7 @@ const stablePackages = {
// These packages do not exist in the @next or @latest channel, only
// @experimental. We don't use semver, just the commit sha, so this is just a
// list of package names instead of a map.
-const experimentalPackages = [
- 'react-fetch',
- 'react-fs',
- 'react-pg',
- 'react-server-dom-webpack',
-];
+const experimentalPackages = ['react-fetch', 'react-fs', 'react-pg'];
module.exports = {
ReactVersion,
diff --git a/fixtures/fizz-ssr-browser/index.html b/fixtures/fizz-ssr-browser/index.html
index 3d2b42231005b..929b88217f540 100644
--- a/fixtures/fizz-ssr-browser/index.html
+++ b/fixtures/fizz-ssr-browser/index.html
@@ -17,6 +17,7 @@ Fizz Example
+
diff --git a/fixtures/flight/src/index.js b/fixtures/flight/src/index.js
index 8a63b80b57f23..71c87a2ea17bc 100644
--- a/fixtures/flight/src/index.js
+++ b/fixtures/flight/src/index.js
@@ -6,7 +6,7 @@ import ReactServerDOMReader from 'react-server-dom-webpack/client';
let data = ReactServerDOMReader.createFromFetch(fetch('http://localhost:3001'));
function Content() {
- return React.experimental_use(data);
+ return React.use(data);
}
ReactDOM.createRoot(document.getElementById('root')).render(
diff --git a/packages/react-client/src/__tests__/ReactFlight-test.js b/packages/react-client/src/__tests__/ReactFlight-test.js
index 81043e1e34687..e974ceb3d6d09 100644
--- a/packages/react-client/src/__tests__/ReactFlight-test.js
+++ b/packages/react-client/src/__tests__/ReactFlight-test.js
@@ -27,7 +27,7 @@ describe('ReactFlight', () => {
React = require('react');
startTransition = React.startTransition;
- use = React.experimental_use;
+ use = React.use;
ReactNoop = require('react-noop-renderer');
ReactNoopFlightServer = require('react-noop-renderer/flight-server');
ReactNoopFlightClient = require('react-noop-renderer/flight-client');
diff --git a/packages/react-dom/index.classic.fb.js b/packages/react-dom/index.classic.fb.js
index 6642943bfdb86..4d05d28ae3348 100644
--- a/packages/react-dom/index.classic.fb.js
+++ b/packages/react-dom/index.classic.fb.js
@@ -33,6 +33,8 @@ export {
unstable_isNewReconciler,
unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
+ preinit,
+ preload,
version,
} from './src/client/ReactDOM';
diff --git a/packages/react-dom/index.experimental.js b/packages/react-dom/index.experimental.js
index 38007a29a23d8..7b8326fb30fbe 100644
--- a/packages/react-dom/index.experimental.js
+++ b/packages/react-dom/index.experimental.js
@@ -20,7 +20,7 @@ export {
unstable_batchedUpdates,
unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
+ preinit,
+ preload,
version,
} from './src/client/ReactDOM';
-
-export {preinit, preload} from 'react-dom-bindings/src/shared/ReactDOMFloat';
diff --git a/packages/react-dom/index.js b/packages/react-dom/index.js
index 2c537e2a28257..a5627c22e7a3e 100644
--- a/packages/react-dom/index.js
+++ b/packages/react-dom/index.js
@@ -25,5 +25,7 @@ export {
unstable_isNewReconciler,
unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
+ preinit,
+ preload,
version,
} from './src/client/ReactDOM';
diff --git a/packages/react-dom/index.modern.fb.js b/packages/react-dom/index.modern.fb.js
index 1eea181ee95ce..8422e6b9ac602 100644
--- a/packages/react-dom/index.modern.fb.js
+++ b/packages/react-dom/index.modern.fb.js
@@ -18,5 +18,7 @@ export {
unstable_flushControlled,
unstable_isNewReconciler,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
+ preinit,
+ preload,
version,
} from './src/client/ReactDOM';
diff --git a/packages/react-dom/index.stable.js b/packages/react-dom/index.stable.js
index b66082b6499b6..5d64bf771c6f6 100644
--- a/packages/react-dom/index.stable.js
+++ b/packages/react-dom/index.stable.js
@@ -19,5 +19,7 @@ export {
unmountComponentAtNode,
unstable_batchedUpdates,
unstable_renderSubtreeIntoContainer,
+ preinit,
+ preload,
version,
} from './src/client/ReactDOM';
diff --git a/packages/react-dom/server-rendering-stub.experimental.js b/packages/react-dom/server-rendering-stub.experimental.js
deleted file mode 100644
index c2f819464b38f..0000000000000
--- a/packages/react-dom/server-rendering-stub.experimental.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- * @flow
- */
-
-// Export all exports so that they're available in tests.
-// We can't use export * from in Flow for some reason.
-
-import ReactVersion from 'shared/ReactVersion';
-export {ReactVersion as version};
-
-export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './src/ReactDOMSharedInternals';
-
-export {
- createPortal,
- flushSync,
-} from './src/server/ReactDOMServerRenderingStub';
-export {preinit, preload} from 'react-dom-bindings/src/shared/ReactDOMFloat';
diff --git a/packages/react-dom/server-rendering-stub.js b/packages/react-dom/server-rendering-stub.js
index 84cec2f9fa39b..e50cb3edb3be1 100644
--- a/packages/react-dom/server-rendering-stub.js
+++ b/packages/react-dom/server-rendering-stub.js
@@ -18,4 +18,6 @@ export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './s
export {
createPortal,
flushSync,
+ preload,
+ preinit,
} from './src/server/ReactDOMServerRenderingStub';
diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
index e19542b62b9bd..62a0bc4d10294 100644
--- a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
+++ b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
@@ -41,9 +41,9 @@ describe('ReactDOMFizzServer', () => {
ReactDOMFizzServer = require('react-dom/server');
Stream = require('stream');
Suspense = React.Suspense;
+ use = React.use;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
- use = React.experimental_use;
}
PropTypes = require('prop-types');
diff --git a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
index dd7baabf6712a..61c8d137acd33 100644
--- a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
+++ b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
@@ -1963,7 +1963,7 @@ describe('ReactDOMFloat', () => {
);
});
- // @gate enableFloat
+ // @gate enableFloat && enableHostSingletons && (enableClientRenderFallbackOnTextMismatch || !__DEV__)
it('can render a title before a singleton even if that singleton clears its contents', async () => {
await actIntoEmptyDocument(() => {
const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
@@ -1975,7 +1975,6 @@ describe('ReactDOMFloat', () => {
server