Update cache() and use() to the canary aka next channel (#25502)

Testing what it would look like to move this to the `next` channel.
This commit is contained in:
Sebastian Markbåge 2022-10-23 23:20:52 -04:00 committed by GitHub
parent fa77f52e74
commit e7c5af45ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 325 additions and 279 deletions

View File

@ -30,6 +30,7 @@ const stablePackages = {
react: ReactVersion, react: ReactVersion,
'react-art': ReactVersion, 'react-art': ReactVersion,
'react-dom': ReactVersion, 'react-dom': ReactVersion,
'react-server-dom-webpack': ReactVersion,
'react-is': ReactVersion, 'react-is': ReactVersion,
'react-reconciler': '0.30.0', 'react-reconciler': '0.30.0',
'react-refresh': '0.15.0', 'react-refresh': '0.15.0',
@ -42,12 +43,7 @@ const stablePackages = {
// These packages do not exist in the @next or @latest channel, only // 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 // @experimental. We don't use semver, just the commit sha, so this is just a
// list of package names instead of a map. // list of package names instead of a map.
const experimentalPackages = [ const experimentalPackages = ['react-fetch', 'react-fs', 'react-pg'];
'react-fetch',
'react-fs',
'react-pg',
'react-server-dom-webpack',
];
module.exports = { module.exports = {
ReactVersion, ReactVersion,

View File

@ -17,6 +17,7 @@
</p> </p>
</div> </div>
<script src="../../build/node_modules/react/umd/react.development.js"></script> <script src="../../build/node_modules/react/umd/react.development.js"></script>
<script src="../../build/node_modules/react-dom/umd/react-dom.development.js"></script>
<script src="../../build/node_modules/react-dom/umd/react-dom-server.browser.development.js"></script> <script src="../../build/node_modules/react-dom/umd/react-dom-server.browser.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.js"></script> <script src="https://unpkg.com/babel-standalone@6/babel.js"></script>
<script type="text/babel"> <script type="text/babel">

View File

@ -83,7 +83,7 @@
} }
function Shell({ data }) { function Shell({ data }) {
let model = React.experimental_use(data); let model = React.use(data);
return <div> return <div>
<Suspense fallback="..."> <Suspense fallback="...">
<h1>{model.title}</h1> <h1>{model.title}</h1>
@ -94,11 +94,12 @@
function renderResult(data) { function renderResult(data) {
let container = document.getElementById('container'); let container = document.getElementById('container');
ReactDOM.render( ReactDOM.createRoot(
container
).render(
<Suspense fallback="Loading..."> <Suspense fallback="Loading...">
<Shell data={data} /> <Shell data={data} />
</Suspense>, </Suspense>,
container
); );
} }
</script> </script>

View File

@ -6,7 +6,7 @@ import ReactServerDOMReader from 'react-server-dom-webpack/client';
let data = ReactServerDOMReader.createFromFetch(fetch('http://localhost:3001')); let data = ReactServerDOMReader.createFromFetch(fetch('http://localhost:3001'));
function Content() { function Content() {
return React.experimental_use(data); return React.use(data);
} }
ReactDOM.createRoot(document.getElementById('root')).render( ReactDOM.createRoot(document.getElementById('root')).render(

View File

@ -27,7 +27,7 @@ describe('ReactFlight', () => {
React = require('react'); React = require('react');
startTransition = React.startTransition; startTransition = React.startTransition;
use = React.experimental_use; use = React.use;
ReactNoop = require('react-noop-renderer'); ReactNoop = require('react-noop-renderer');
ReactNoopFlightServer = require('react-noop-renderer/flight-server'); ReactNoopFlightServer = require('react-noop-renderer/flight-server');
ReactNoopFlightClient = require('react-noop-renderer/flight-client'); ReactNoopFlightClient = require('react-noop-renderer/flight-client');

View File

@ -33,6 +33,8 @@ export {
unstable_isNewReconciler, unstable_isNewReconciler,
unstable_renderSubtreeIntoContainer, unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority. unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
preinit,
preload,
version, version,
} from './src/client/ReactDOM'; } from './src/client/ReactDOM';

View File

@ -20,7 +20,7 @@ export {
unstable_batchedUpdates, unstable_batchedUpdates,
unstable_renderSubtreeIntoContainer, unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority. unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
preinit,
preload,
version, version,
} from './src/client/ReactDOM'; } from './src/client/ReactDOM';
export {preinit, preload} from 'react-dom-bindings/src/shared/ReactDOMFloat';

View File

@ -25,5 +25,7 @@ export {
unstable_isNewReconciler, unstable_isNewReconciler,
unstable_renderSubtreeIntoContainer, unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority. unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
preinit,
preload,
version, version,
} from './src/client/ReactDOM'; } from './src/client/ReactDOM';

View File

@ -18,5 +18,7 @@ export {
unstable_flushControlled, unstable_flushControlled,
unstable_isNewReconciler, unstable_isNewReconciler,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority. unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
preinit,
preload,
version, version,
} from './src/client/ReactDOM'; } from './src/client/ReactDOM';

View File

@ -19,5 +19,7 @@ export {
unmountComponentAtNode, unmountComponentAtNode,
unstable_batchedUpdates, unstable_batchedUpdates,
unstable_renderSubtreeIntoContainer, unstable_renderSubtreeIntoContainer,
preinit,
preload,
version, version,
} from './src/client/ReactDOM'; } from './src/client/ReactDOM';

View File

@ -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';

View File

@ -18,4 +18,6 @@ export {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './s
export { export {
createPortal, createPortal,
flushSync, flushSync,
preload,
preinit,
} from './src/server/ReactDOMServerRenderingStub'; } from './src/server/ReactDOMServerRenderingStub';

View File

@ -41,9 +41,9 @@ describe('ReactDOMFizzServer', () => {
ReactDOMFizzServer = require('react-dom/server'); ReactDOMFizzServer = require('react-dom/server');
Stream = require('stream'); Stream = require('stream');
Suspense = React.Suspense; Suspense = React.Suspense;
use = React.use;
if (gate(flags => flags.enableSuspenseList)) { if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList; SuspenseList = React.SuspenseList;
use = React.experimental_use;
} }
PropTypes = require('prop-types'); PropTypes = require('prop-types');

View File

@ -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 () => { it('can render a title before a singleton even if that singleton clears its contents', async () => {
await actIntoEmptyDocument(() => { await actIntoEmptyDocument(() => {
const {pipe} = ReactDOMFizzServer.renderToPipeableStream( const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
@ -1975,7 +1975,6 @@ describe('ReactDOMFloat', () => {
<div>server</div> <div>server</div>
</body> </body>
</html> </html>
,
</>, </>,
); );
pipe(writable); pipe(writable);
@ -2243,7 +2242,7 @@ describe('ReactDOMFloat', () => {
); );
}); });
// @gate enableFloat && enableHostSingletons // @gate enableFloat && enableHostSingletons && enableClientRenderFallbackOnTextMismatch
it('retains styles even when a new html, head, and/body mount', async () => { it('retains styles even when a new html, head, and/body mount', async () => {
await actIntoEmptyDocument(() => { await actIntoEmptyDocument(() => {
const {pipe} = ReactDOMFizzServer.renderToPipeableStream( const {pipe} = ReactDOMFizzServer.renderToPipeableStream(

View File

@ -15,7 +15,6 @@ describe('ReactDOMInReactServer', () => {
jest.mock('react', () => require('react/react.shared-subset')); jest.mock('react', () => require('react/react.shared-subset'));
}); });
// @gate experimental && !www
it('can require react-dom', () => { it('can require react-dom', () => {
// In RSC this will be aliased. // In RSC this will be aliased.
require('react'); require('react');

View File

@ -153,7 +153,7 @@ function resolveMostRecentTextCache(text) {
const resolveText = resolveMostRecentTextCache; const resolveText = resolveMostRecentTextCache;
// @gate enableCache // @gate enableLegacyCache
// @gate enableSuspenseList // @gate enableSuspenseList
test('regression (#20932): return pointer is correct before entering deleted tree', async () => { test('regression (#20932): return pointer is correct before entering deleted tree', async () => {
// Based on a production bug. Designed to trigger a very specific // Based on a production bug. Designed to trigger a very specific

View File

@ -76,6 +76,8 @@ import {
} from 'react-dom-bindings/src/events/ReactDOMControlledComponent'; } from 'react-dom-bindings/src/events/ReactDOMControlledComponent';
import Internals from '../ReactDOMSharedInternals'; import Internals from '../ReactDOMSharedInternals';
export {preinit, preload} from 'react-dom-bindings/src/shared/ReactDOMFloat';
setAttemptSynchronousHydration(attemptSynchronousHydration); setAttemptSynchronousHydration(attemptSynchronousHydration);
setAttemptDiscreteHydration(attemptDiscreteHydration); setAttemptDiscreteHydration(attemptDiscreteHydration);
setAttemptContinuousHydration(attemptContinuousHydration); setAttemptContinuousHydration(attemptContinuousHydration);

View File

@ -7,6 +7,8 @@
* @flow * @flow
*/ */
export {preinit, preload} from 'react-dom-bindings/src/shared/ReactDOMFloat';
export function createPortal() { export function createPortal() {
throw new Error( throw new Error(
'createPortal was called on the server. Portals are not currently' + 'createPortal was called on the server. Portals are not currently' +

View File

@ -40,6 +40,7 @@ import {
enableUseHook, enableUseHook,
enableUseMemoCacheHook, enableUseMemoCacheHook,
enableUseEventHook, enableUseEventHook,
enableLegacyCache,
} from 'shared/ReactFeatureFlags'; } from 'shared/ReactFeatureFlags';
import { import {
REACT_CONTEXT_TYPE, REACT_CONTEXT_TYPE,
@ -2357,9 +2358,17 @@ function refreshCache<T>(fiber: Fiber, seedKey: ?() => T, seedValue: T) {
// unmount that boundary before the refresh completes. // unmount that boundary before the refresh completes.
const seededCache = createCache(); const seededCache = createCache();
if (seedKey !== null && seedKey !== undefined && root !== null) { if (seedKey !== null && seedKey !== undefined && root !== null) {
// Seed the cache with the value passed by the caller. This could be if (enableLegacyCache) {
// from a server mutation, or it could be a streaming response. // Seed the cache with the value passed by the caller. This could be
seededCache.data.set(seedKey, seedValue); // from a server mutation, or it could be a streaming response.
seededCache.data.set(seedKey, seedValue);
} else {
if (__DEV__) {
console.error(
'The seed argument is not enabled outside experimental channels.',
);
}
}
} }
const payload = { const payload = {

View File

@ -40,6 +40,7 @@ import {
enableUseHook, enableUseHook,
enableUseMemoCacheHook, enableUseMemoCacheHook,
enableUseEventHook, enableUseEventHook,
enableLegacyCache,
} from 'shared/ReactFeatureFlags'; } from 'shared/ReactFeatureFlags';
import { import {
REACT_CONTEXT_TYPE, REACT_CONTEXT_TYPE,
@ -2357,9 +2358,17 @@ function refreshCache<T>(fiber: Fiber, seedKey: ?() => T, seedValue: T) {
// unmount that boundary before the refresh completes. // unmount that boundary before the refresh completes.
const seededCache = createCache(); const seededCache = createCache();
if (seedKey !== null && seedKey !== undefined && root !== null) { if (seedKey !== null && seedKey !== undefined && root !== null) {
// Seed the cache with the value passed by the caller. This could be if (enableLegacyCache) {
// from a server mutation, or it could be a streaming response. // Seed the cache with the value passed by the caller. This could be
seededCache.data.set(seedKey, seedValue); // from a server mutation, or it could be a streaming response.
seededCache.data.set(seedKey, seedValue);
} else {
if (__DEV__) {
console.error(
'The seed argument is not enabled outside experimental channels.',
);
}
}
} }
const payload = { const payload = {

View File

@ -292,7 +292,7 @@ describe('act warnings', () => {
}); });
// @gate __DEV__ // @gate __DEV__
// @gate enableCache // @gate enableLegacyCache
test('warns if Suspense retry is not wrapped', () => { test('warns if Suspense retry is not wrapped', () => {
function App() { function App() {
return ( return (
@ -322,7 +322,7 @@ describe('act warnings', () => {
}); });
// @gate __DEV__ // @gate __DEV__
// @gate enableCache // @gate enableLegacyCache
test('warns if Suspense ping is not wrapped', () => { test('warns if Suspense ping is not wrapped', () => {
function App({showMore}) { function App({showMore}) {
return ( return (

View File

@ -25,7 +25,7 @@ describe('ReactCache', () => {
Scheduler = require('scheduler'); Scheduler = require('scheduler');
act = require('jest-react').act; act = require('jest-react').act;
Suspense = React.Suspense; Suspense = React.Suspense;
cache = React.experimental_cache; cache = React.cache;
Offscreen = React.unstable_Offscreen; Offscreen = React.unstable_Offscreen;
getCacheSignal = React.unstable_getCacheSignal; getCacheSignal = React.unstable_getCacheSignal;
useCacheRefresh = React.unstable_useCacheRefresh; useCacheRefresh = React.unstable_useCacheRefresh;
@ -85,7 +85,7 @@ describe('ReactCache', () => {
}); });
function readText(text) { function readText(text) {
const signal = getCacheSignal(); const signal = getCacheSignal ? getCacheSignal() : null;
const textCache = getTextCache(); const textCache = getTextCache();
const record = textCache.data.get(text); const record = textCache.data.get(text);
if (record !== undefined) { if (record !== undefined) {
@ -94,11 +94,13 @@ describe('ReactCache', () => {
// schedule a cleanup function for it. // schedule a cleanup function for it.
// TODO: Add ability to cleanup entries seeded w useCacheRefresh() // TODO: Add ability to cleanup entries seeded w useCacheRefresh()
record.cleanupScheduled = true; record.cleanupScheduled = true;
signal.addEventListener('abort', () => { if (getCacheSignal) {
Scheduler.unstable_yieldValue( signal.addEventListener('abort', () => {
`Cache cleanup: ${text} [v${textCache.version}]`, Scheduler.unstable_yieldValue(
); `Cache cleanup: ${text} [v${textCache.version}]`,
}); );
});
}
} }
switch (record.status) { switch (record.status) {
case 'pending': case 'pending':
@ -140,11 +142,13 @@ describe('ReactCache', () => {
}; };
textCache.data.set(text, newRecord); textCache.data.set(text, newRecord);
signal.addEventListener('abort', () => { if (getCacheSignal) {
Scheduler.unstable_yieldValue( signal.addEventListener('abort', () => {
`Cache cleanup: ${text} [v${textCache.version}]`, Scheduler.unstable_yieldValue(
); `Cache cleanup: ${text} [v${textCache.version}]`,
}); );
});
}
throw thenable; throw thenable;
} }
} }
@ -178,7 +182,7 @@ describe('ReactCache', () => {
} }
} }
// @gate experimental || www // @gate enableCacheElement && enableCache
test('render Cache component', async () => { test('render Cache component', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
await act(async () => { await act(async () => {
@ -187,7 +191,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Hi'); expect(root).toMatchRenderedOutput('Hi');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('mount new data', async () => { test('mount new data', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
await act(async () => { await act(async () => {
@ -216,7 +220,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCache
test('root acts as implicit cache boundary', async () => { test('root acts as implicit cache boundary', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
await act(async () => { await act(async () => {
@ -243,7 +247,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('multiple new Cache boundaries in the same mount share the same, fresh root cache', async () => { test('multiple new Cache boundaries in the same mount share the same, fresh root cache', async () => {
function App() { function App() {
return ( return (
@ -290,7 +294,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('multiple new Cache boundaries in the same update share the same, fresh cache', async () => { test('multiple new Cache boundaries in the same update share the same, fresh cache', async () => {
function App({showMore}) { function App({showMore}) {
return showMore ? ( return showMore ? (
@ -346,7 +350,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test( test(
'nested cache boundaries share the same cache as the root during ' + 'nested cache boundaries share the same cache as the root during ' +
'the initial render', 'the initial render',
@ -386,7 +390,7 @@ describe('ReactCache', () => {
}, },
); );
// @gate experimental || www // @gate enableCacheElement && enableCache
test('new content inside an existing Cache boundary should re-use already cached data', async () => { test('new content inside an existing Cache boundary should re-use already cached data', async () => {
function App({showMore}) { function App({showMore}) {
return ( return (
@ -430,7 +434,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('a new Cache boundary uses fresh cache', async () => { test('a new Cache boundary uses fresh cache', async () => {
// The only difference from the previous test is that the "Show More" // The only difference from the previous test is that the "Show More"
// content is wrapped in a nested <Cache /> boundary // content is wrapped in a nested <Cache /> boundary
@ -488,7 +492,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('inner/outer cache boundaries uses the same cache instance on initial render', async () => { test('inner/outer cache boundaries uses the same cache instance on initial render', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
@ -570,7 +574,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('inner/ outer cache boundaries added in the same update use the same cache instance', async () => { test('inner/ outer cache boundaries added in the same update use the same cache instance', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
@ -662,7 +666,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCache
test('refresh a cache boundary', async () => { test('refresh a cache boundary', async () => {
let refresh; let refresh;
function App() { function App() {
@ -674,11 +678,9 @@ describe('ReactCache', () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
await act(async () => { await act(async () => {
root.render( root.render(
<Cache> <Suspense fallback={<Text text="Loading..." />}>
<Suspense fallback={<Text text="Loading..." />}> <App />
<App /> </Suspense>,
</Suspense>
</Cache>,
); );
}); });
expect(Scheduler).toHaveYielded(['Cache miss! [A]', 'Loading...']); expect(Scheduler).toHaveYielded(['Cache miss! [A]', 'Loading...']);
@ -701,19 +703,20 @@ describe('ReactCache', () => {
resolveMostRecentTextCache('A'); resolveMostRecentTextCache('A');
}); });
// Note that the version has updated // Note that the version has updated
expect(Scheduler).toHaveYielded(['A [v2]']); if (getCacheSignal) {
expect(Scheduler).toHaveYielded(['A [v2]', 'Cache cleanup: A [v1]']);
} else {
expect(Scheduler).toHaveYielded(['A [v2]']);
}
expect(root).toMatchRenderedOutput('A [v2]'); expect(root).toMatchRenderedOutput('A [v2]');
await act(async () => { await act(async () => {
root.render('Bye'); root.render('Bye');
}); });
// the original cache instance does not cleanup since it is still referenced
// by the root, but the refreshed inner cache does cleanup
expect(Scheduler).toHaveYielded(['Cache cleanup: A [v2]']);
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('refresh the root cache', async () => { test('refresh the root cache', async () => {
let refresh; let refresh;
function App() { function App() {
@ -761,7 +764,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('refresh the root cache without a transition', async () => { test('refresh the root cache without a transition', async () => {
let refresh; let refresh;
function App() { function App() {
@ -816,7 +819,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('refresh a cache with seed data', async () => { test('refresh a cache with seed data', async () => {
let refreshWithSeed; let refreshWithSeed;
function App() { function App() {
@ -879,7 +882,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye'); expect(root).toMatchRenderedOutput('Bye');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('refreshing a parent cache also refreshes its children', async () => { test('refreshing a parent cache also refreshes its children', async () => {
let refreshShell; let refreshShell;
function RefreshShell() { function RefreshShell() {
@ -958,7 +961,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test( test(
'refreshing a cache boundary does not refresh the other boundaries ' + 'refreshing a cache boundary does not refresh the other boundaries ' +
'that mounted at the same time (i.e. the ones that share the same cache)', 'that mounted at the same time (i.e. the ones that share the same cache)',
@ -1046,7 +1049,7 @@ describe('ReactCache', () => {
}, },
); );
// @gate experimental || www // @gate enableCacheElement && enableCache
test( test(
'mount a new Cache boundary in a sibling while simultaneously ' + 'mount a new Cache boundary in a sibling while simultaneously ' +
'resolving a Suspense boundary', 'resolving a Suspense boundary',
@ -1119,7 +1122,7 @@ describe('ReactCache', () => {
}, },
); );
// @gate experimental || www // @gate enableCacheElement && enableCache
test('cache pool is cleared once transitions that depend on it commit their shell', async () => { test('cache pool is cleared once transitions that depend on it commit their shell', async () => {
function Child({text}) { function Child({text}) {
return ( return (
@ -1215,7 +1218,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('cache pool is not cleared by arbitrary commits', async () => { test('cache pool is not cleared by arbitrary commits', async () => {
function App() { function App() {
return ( return (
@ -1294,7 +1297,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('cache boundary uses a fresh cache when its key changes', async () => { test('cache boundary uses a fresh cache when its key changes', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
seedNextTextCache('A'); seedNextTextCache('A');
@ -1333,7 +1336,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('overlapping transitions after an initial mount use the same fresh cache', async () => { test('overlapping transitions after an initial mount use the same fresh cache', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
await act(async () => { await act(async () => {
@ -1404,7 +1407,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('overlapping updates after an initial mount use the same fresh cache', async () => { test('overlapping updates after an initial mount use the same fresh cache', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
await act(async () => { await act(async () => {
@ -1470,7 +1473,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test('cleans up cache only used in an aborted transition', async () => { test('cleans up cache only used in an aborted transition', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
seedNextTextCache('A'); seedNextTextCache('A');
@ -1525,7 +1528,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test.skip('if a root cache refresh never commits its fresh cache is released', async () => { test.skip('if a root cache refresh never commits its fresh cache is released', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
let refresh; let refresh;
@ -1567,7 +1570,7 @@ describe('ReactCache', () => {
expect(root).toMatchRenderedOutput('Bye!'); expect(root).toMatchRenderedOutput('Bye!');
}); });
// @gate experimental || www // @gate enableCacheElement && enableCache
test.skip('if a cache boundary refresh never commits its fresh cache is released', async () => { test.skip('if a cache boundary refresh never commits its fresh cache is released', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
let refresh; let refresh;

View File

@ -157,7 +157,7 @@ describe('ReactConcurrentErrorRecovery', () => {
const rejectText = rejectMostRecentTextCache; const rejectText = rejectMostRecentTextCache;
// @gate enableCache // @gate enableLegacyCache
test('errors during a refresh transition should not force fallbacks to display (suspend then error)', async () => { test('errors during a refresh transition should not force fallbacks to display (suspend then error)', async () => {
class ErrorBoundary extends React.Component { class ErrorBoundary extends React.Component {
state = {error: null}; state = {error: null};
@ -278,7 +278,7 @@ describe('ReactConcurrentErrorRecovery', () => {
expect(root).toMatchRenderedOutput('A2Oops!'); expect(root).toMatchRenderedOutput('A2Oops!');
}); });
// @gate enableCache // @gate enableLegacyCache
test('errors during a refresh transition should not force fallbacks to display (error then suspend)', async () => { test('errors during a refresh transition should not force fallbacks to display (error then suspend)', async () => {
class ErrorBoundary extends React.Component { class ErrorBoundary extends React.Component {
state = {error: null}; state = {error: null};
@ -399,7 +399,7 @@ describe('ReactConcurrentErrorRecovery', () => {
expect(root).toMatchRenderedOutput('Oops!B2'); expect(root).toMatchRenderedOutput('Oops!B2');
}); });
// @gate enableCache // @gate enableLegacyCache
test('suspending in the shell (outside a Suspense boundary) should not throw, warn, or log during a transition', async () => { test('suspending in the shell (outside a Suspense boundary) should not throw, warn, or log during a transition', async () => {
class ErrorBoundary extends React.Component { class ErrorBoundary extends React.Component {
state = {error: null}; state = {error: null};
@ -449,7 +449,7 @@ describe('ReactConcurrentErrorRecovery', () => {
expect(root).toMatchRenderedOutput('Async'); expect(root).toMatchRenderedOutput('Async');
}); });
// @gate enableCache // @gate enableLegacyCache
test( test(
'errors during a suspended transition at the shell should not force ' + 'errors during a suspended transition at the shell should not force ' +
'fallbacks to display (error then suspend)', 'fallbacks to display (error then suspend)',

View File

@ -344,7 +344,7 @@ describe('ReactLazyContextPropagation', () => {
expect(root).toMatchRenderedOutput('0'); expect(root).toMatchRenderedOutput('0');
}); });
// @gate enableCache // @gate enableLegacyCache
test('context is propagated across retries', async () => { test('context is propagated across retries', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
@ -405,7 +405,7 @@ describe('ReactLazyContextPropagation', () => {
expect(root).toMatchRenderedOutput('BB'); expect(root).toMatchRenderedOutput('BB');
}); });
// @gate enableCache // @gate enableLegacyCache
test('multiple contexts are propagated across retries', async () => { test('multiple contexts are propagated across retries', async () => {
// Same as previous test, but with multiple context providers // Same as previous test, but with multiple context providers
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
@ -485,7 +485,7 @@ describe('ReactLazyContextPropagation', () => {
expect(root).toMatchRenderedOutput('BBB'); expect(root).toMatchRenderedOutput('BBB');
}); });
// @gate enableCache // @gate enableLegacyCache
test('context is propagated across retries (legacy)', async () => { test('context is propagated across retries (legacy)', async () => {
const root = ReactNoop.createLegacyRoot(); const root = ReactNoop.createLegacyRoot();
@ -749,7 +749,7 @@ describe('ReactLazyContextPropagation', () => {
expect(root).toMatchRenderedOutput('BB'); expect(root).toMatchRenderedOutput('BB');
}); });
// @gate enableCache // @gate enableLegacyCache
test('nested bailouts across retries', async () => { test('nested bailouts across retries', async () => {
// Lazy context propagation will stop propagating when it hits the first // Lazy context propagation will stop propagating when it hits the first
// match. If we bail out again inside that tree, we must resume propagating. // match. If we bail out again inside that tree, we must resume propagating.

View File

@ -25,7 +25,7 @@ describe('isomorphic act()', () => {
DiscreteEventPriority = require('react-reconciler/constants') DiscreteEventPriority = require('react-reconciler/constants')
.DiscreteEventPriority; .DiscreteEventPriority;
act = React.unstable_act; act = React.unstable_act;
use = React.experimental_use; use = React.use;
Suspense = React.Suspense; Suspense = React.Suspense;
startTransition = React.startTransition; startTransition = React.startTransition;
}); });

View File

@ -206,7 +206,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
} }
describe('when a component suspends during initial mount', () => { describe('when a component suspends during initial mount', () => {
// @gate enableCache // @gate enableLegacyCache
it('should not change behavior in concurrent mode', async () => { it('should not change behavior in concurrent mode', async () => {
class ClassText extends React.Component { class ClassText extends React.Component {
componentDidMount() { componentDidMount() {
@ -323,7 +323,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
expect(ReactNoop.getChildren()).toEqual([]); expect(ReactNoop.getChildren()).toEqual([]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should not change behavior in sync', async () => { it('should not change behavior in sync', async () => {
class ClassText extends React.Component { class ClassText extends React.Component {
componentDidMount() { componentDidMount() {
@ -442,7 +442,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
}); });
describe('layout effects within a tree that re-suspends in an update', () => { describe('layout effects within a tree that re-suspends in an update', () => {
// @gate enableCache // @gate enableLegacyCache
it('should not be destroyed or recreated in legacy roots', async () => { it('should not be destroyed or recreated in legacy roots', async () => {
function App({children = null}) { function App({children = null}) {
Scheduler.unstable_yieldValue('App render'); Scheduler.unstable_yieldValue('App render');
@ -565,7 +565,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be destroyed and recreated for function components', async () => { it('should be destroyed and recreated for function components', async () => {
function App({children = null}) { function App({children = null}) {
Scheduler.unstable_yieldValue('App render'); Scheduler.unstable_yieldValue('App render');
@ -693,7 +693,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be destroyed and recreated for class components', async () => { it('should be destroyed and recreated for class components', async () => {
class ClassText extends React.Component { class ClassText extends React.Component {
componentDidMount() { componentDidMount() {
@ -837,7 +837,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be destroyed and recreated when nested below host components', async () => { it('should be destroyed and recreated when nested below host components', async () => {
function App({children = null}) { function App({children = null}) {
Scheduler.unstable_yieldValue('App render'); Scheduler.unstable_yieldValue('App render');
@ -946,7 +946,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be destroyed and recreated even if there is a bailout because of memoization', async () => { it('should be destroyed and recreated even if there is a bailout because of memoization', async () => {
const MemoizedText = React.memo(Text, () => true); const MemoizedText = React.memo(Text, () => true);
@ -1061,7 +1061,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should respect nested suspense boundaries', async () => { it('should respect nested suspense boundaries', async () => {
function App({innerChildren = null, outerChildren = null}) { function App({innerChildren = null, outerChildren = null}) {
return ( return (
@ -1283,7 +1283,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should show nested host nodes if multiple boundaries resolve at the same time', async () => { it('should show nested host nodes if multiple boundaries resolve at the same time', async () => {
function App({innerChildren = null, outerChildren = null}) { function App({innerChildren = null, outerChildren = null}) {
return ( return (
@ -1392,7 +1392,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be cleaned up inside of a fallback that suspends', async () => { it('should be cleaned up inside of a fallback that suspends', async () => {
function App({fallbackChildren = null, outerChildren = null}) { function App({fallbackChildren = null, outerChildren = null}) {
return ( return (
@ -1534,7 +1534,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be cleaned up inside of a fallback that suspends (alternate)', async () => { it('should be cleaned up inside of a fallback that suspends (alternate)', async () => {
function App({fallbackChildren = null, outerChildren = null}) { function App({fallbackChildren = null, outerChildren = null}) {
return ( return (
@ -1653,7 +1653,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be cleaned up deeper inside of a subtree that suspends', async () => { it('should be cleaned up deeper inside of a subtree that suspends', async () => {
function ConditionalSuspense({shouldSuspend}) { function ConditionalSuspense({shouldSuspend}) {
if (shouldSuspend) { if (shouldSuspend) {
@ -1735,7 +1735,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
}); });
describe('that throw errors', () => { describe('that throw errors', () => {
// @gate enableCache // @gate enableLegacyCache
it('are properly handled for componentDidMount', async () => { it('are properly handled for componentDidMount', async () => {
let componentDidMountShouldThrow = false; let componentDidMountShouldThrow = false;
@ -1873,7 +1873,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
expect(ReactNoop.getChildren()).toEqual([span('Error')]); expect(ReactNoop.getChildren()).toEqual([span('Error')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('are properly handled for componentWillUnmount', async () => { it('are properly handled for componentWillUnmount', async () => {
class ThrowsInWillUnmount extends React.Component { class ThrowsInWillUnmount extends React.Component {
componentDidMount() { componentDidMount() {
@ -1984,7 +1984,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
expect(ReactNoop.getChildren()).toEqual([span('Error')]); expect(ReactNoop.getChildren()).toEqual([span('Error')]);
}); });
// @gate enableCache // @gate enableLegacyCache
// @gate replayFailedUnitOfWorkWithInvokeGuardedCallback // @gate replayFailedUnitOfWorkWithInvokeGuardedCallback
it('are properly handled for layout effect creation', async () => { it('are properly handled for layout effect creation', async () => {
let useLayoutEffectShouldThrow = false; let useLayoutEffectShouldThrow = false;
@ -2123,7 +2123,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
expect(ReactNoop.getChildren()).toEqual([span('Error')]); expect(ReactNoop.getChildren()).toEqual([span('Error')]);
}); });
// @gate enableCache // @gate enableLegacyCache
// @gate replayFailedUnitOfWorkWithInvokeGuardedCallback // @gate replayFailedUnitOfWorkWithInvokeGuardedCallback
it('are properly handled for layout effect destruction', async () => { it('are properly handled for layout effect destruction', async () => {
function ThrowsInLayoutEffectDestroy() { function ThrowsInLayoutEffectDestroy() {
@ -2234,7 +2234,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
}); });
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be only destroy layout effects once if a tree suspends in multiple places', async () => { it('should be only destroy layout effects once if a tree suspends in multiple places', async () => {
class ClassText extends React.Component { class ClassText extends React.Component {
componentDidMount() { componentDidMount() {
@ -2372,7 +2372,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be only destroy layout effects once if a component suspends multiple times', async () => { it('should be only destroy layout effects once if a component suspends multiple times', async () => {
class ClassText extends React.Component { class ClassText extends React.Component {
componentDidMount() { componentDidMount() {
@ -2569,7 +2569,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
return null; return null;
} }
// @gate enableCache // @gate enableLegacyCache
it('should not be cleared within legacy roots', async () => { it('should not be cleared within legacy roots', async () => {
class ClassComponent extends React.Component { class ClassComponent extends React.Component {
render() { render() {
@ -2655,7 +2655,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
expect(ReactNoop.getChildren()).toEqual([]); expect(ReactNoop.getChildren()).toEqual([]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be cleared and reset for host components', async () => { it('should be cleared and reset for host components', async () => {
function App({children}) { function App({children}) {
Scheduler.unstable_yieldValue(`App render`); Scheduler.unstable_yieldValue(`App render`);
@ -2751,7 +2751,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
expect(ReactNoop.getChildren()).toEqual([]); expect(ReactNoop.getChildren()).toEqual([]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be cleared and reset for class components', async () => { it('should be cleared and reset for class components', async () => {
class ClassComponent extends React.Component { class ClassComponent extends React.Component {
render() { render() {
@ -2851,7 +2851,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
expect(ReactNoop.getChildren()).toEqual([]); expect(ReactNoop.getChildren()).toEqual([]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should be cleared and reset for function components with useImperativeHandle', async () => { it('should be cleared and reset for function components with useImperativeHandle', async () => {
const FunctionComponent = React.forwardRef((props, ref) => { const FunctionComponent = React.forwardRef((props, ref) => {
Scheduler.unstable_yieldValue('FunctionComponent render'); Scheduler.unstable_yieldValue('FunctionComponent render');
@ -2955,7 +2955,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
expect(ReactNoop.getChildren()).toEqual([]); expect(ReactNoop.getChildren()).toEqual([]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should not reset for user-managed values', async () => { it('should not reset for user-managed values', async () => {
function RefChecker({forwardedRef}) { function RefChecker({forwardedRef}) {
Scheduler.unstable_yieldValue(`RefChecker render`); Scheduler.unstable_yieldValue(`RefChecker render`);
@ -3052,7 +3052,7 @@ describe('ReactSuspenseEffectsSemantics', () => {
}); });
describe('that throw errors', () => { describe('that throw errors', () => {
// @gate enableCache // @gate enableLegacyCache
// @gate replayFailedUnitOfWorkWithInvokeGuardedCallback // @gate replayFailedUnitOfWorkWithInvokeGuardedCallback
it('are properly handled in ref callbacks', async () => { it('are properly handled in ref callbacks', async () => {
let useRefCallbackShouldThrow = false; let useRefCallbackShouldThrow = false;

View File

@ -131,7 +131,7 @@ describe('ReactSuspenseFallback', () => {
return {type: 'span', children: [], prop, hidden: false}; return {type: 'span', children: [], prop, hidden: false};
} }
// @gate enableCache // @gate enableLegacyCache
it('suspends and shows fallback', () => { it('suspends and shows fallback', () => {
ReactNoop.render( ReactNoop.render(
<Suspense fallback={<Text text="Loading..." />}> <Suspense fallback={<Text text="Loading..." />}>
@ -143,7 +143,7 @@ describe('ReactSuspenseFallback', () => {
expect(ReactNoop.getChildren()).toEqual([span('Loading...')]); expect(ReactNoop.getChildren()).toEqual([span('Loading...')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends and shows null fallback', () => { it('suspends and shows null fallback', () => {
ReactNoop.render( ReactNoop.render(
<Suspense fallback={null}> <Suspense fallback={null}>
@ -158,7 +158,7 @@ describe('ReactSuspenseFallback', () => {
expect(ReactNoop.getChildren()).toEqual([]); expect(ReactNoop.getChildren()).toEqual([]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends and shows undefined fallback', () => { it('suspends and shows undefined fallback', () => {
ReactNoop.render( ReactNoop.render(
<Suspense> <Suspense>
@ -173,7 +173,7 @@ describe('ReactSuspenseFallback', () => {
expect(ReactNoop.getChildren()).toEqual([]); expect(ReactNoop.getChildren()).toEqual([]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends and shows inner fallback', () => { it('suspends and shows inner fallback', () => {
ReactNoop.render( ReactNoop.render(
<Suspense fallback={<Text text="Should not show..." />}> <Suspense fallback={<Text text="Should not show..." />}>
@ -187,7 +187,7 @@ describe('ReactSuspenseFallback', () => {
expect(ReactNoop.getChildren()).toEqual([span('Loading...')]); expect(ReactNoop.getChildren()).toEqual([span('Loading...')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends and shows inner undefined fallback', () => { it('suspends and shows inner undefined fallback', () => {
ReactNoop.render( ReactNoop.render(
<Suspense fallback={<Text text="Should not show..." />}> <Suspense fallback={<Text text="Should not show..." />}>
@ -204,7 +204,7 @@ describe('ReactSuspenseFallback', () => {
expect(ReactNoop.getChildren()).toEqual([]); expect(ReactNoop.getChildren()).toEqual([]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends and shows inner null fallback', () => { it('suspends and shows inner null fallback', () => {
ReactNoop.render( ReactNoop.render(
<Suspense fallback={<Text text="Should not show..." />}> <Suspense fallback={<Text text="Should not show..." />}>

View File

@ -190,7 +190,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
} }
// @gate enableCache // @gate enableLegacyCache
it('does not restart rendering for initial render', async () => { it('does not restart rendering for initial render', async () => {
function Bar(props) { function Bar(props) {
Scheduler.unstable_yieldValue('Bar'); Scheduler.unstable_yieldValue('Bar');
@ -259,7 +259,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends rendering and continues later', async () => { it('suspends rendering and continues later', async () => {
function Bar(props) { function Bar(props) {
Scheduler.unstable_yieldValue('Bar'); Scheduler.unstable_yieldValue('Bar');
@ -310,7 +310,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends siblings and later recovers each independently', async () => { it('suspends siblings and later recovers each independently', async () => {
// Render two sibling Suspense components // Render two sibling Suspense components
ReactNoop.render( ReactNoop.render(
@ -349,7 +349,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('continues rendering siblings after suspending', async () => { it('continues rendering siblings after suspending', async () => {
// A shell is needed. The update cause it to suspend. // A shell is needed. The update cause it to suspend.
ReactNoop.render(<Suspense fallback={<Text text="Loading..." />} />); ReactNoop.render(<Suspense fallback={<Text text="Loading..." />} />);
@ -402,7 +402,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// Second condition is redundant but guarantees that the test runs in prod. // Second condition is redundant but guarantees that the test runs in prod.
// TODO: Delete this feature flag. // TODO: Delete this feature flag.
// @gate !replayFailedUnitOfWorkWithInvokeGuardedCallback || !__DEV__ // @gate !replayFailedUnitOfWorkWithInvokeGuardedCallback || !__DEV__
// @gate enableCache // @gate enableLegacyCache
it('retries on error', async () => { it('retries on error', async () => {
class ErrorBoundary extends React.Component { class ErrorBoundary extends React.Component {
state = {error: null}; state = {error: null};
@ -466,7 +466,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// Second condition is redundant but guarantees that the test runs in prod. // Second condition is redundant but guarantees that the test runs in prod.
// TODO: Delete this feature flag. // TODO: Delete this feature flag.
// @gate !replayFailedUnitOfWorkWithInvokeGuardedCallback || !__DEV__ // @gate !replayFailedUnitOfWorkWithInvokeGuardedCallback || !__DEV__
// @gate enableCache // @gate enableLegacyCache
it('retries on error after falling back to a placeholder', async () => { it('retries on error after falling back to a placeholder', async () => {
class ErrorBoundary extends React.Component { class ErrorBoundary extends React.Component {
state = {error: null}; state = {error: null};
@ -515,7 +515,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('can update at a higher priority while in a suspended state', async () => { it('can update at a higher priority while in a suspended state', async () => {
function App(props) { function App(props) {
return ( return (
@ -555,7 +555,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('B'), span('1')]); expect(ReactNoop.getChildren()).toEqual([span('B'), span('1')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('keeps working on lower priority work after being pinged', async () => { it('keeps working on lower priority work after being pinged', async () => {
// Advance the virtual time so that we're close to the edge of a bucket. // Advance the virtual time so that we're close to the edge of a bucket.
ReactNoop.expire(149); ReactNoop.expire(149);
@ -601,7 +601,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('tries rendering a lower priority pending update even if a higher priority one suspends', async () => { it('tries rendering a lower priority pending update even if a higher priority one suspends', async () => {
function App(props) { function App(props) {
if (props.hide) { if (props.hide) {
@ -708,7 +708,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(Scheduler).toHaveYielded(['Sibling', 'Step 4']); expect(Scheduler).toHaveYielded(['Sibling', 'Step 4']);
}); });
// @gate enableCache // @gate enableLegacyCache
it('forces an expiration after an update times out', async () => { it('forces an expiration after an update times out', async () => {
ReactNoop.render( ReactNoop.render(
<Fragment> <Fragment>
@ -753,7 +753,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('Async'), span('Sync')]); expect(ReactNoop.getChildren()).toEqual([span('Async'), span('Sync')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('switches to an inner fallback after suspending for a while', async () => { it('switches to an inner fallback after suspending for a while', async () => {
// Advance the virtual time so that we're closer to the edge of a bucket. // Advance the virtual time so that we're closer to the edge of a bucket.
ReactNoop.expire(200); ReactNoop.expire(200);
@ -818,7 +818,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('renders an expiration boundary synchronously', async () => { it('renders an expiration boundary synchronously', async () => {
spyOnDev(console, 'error'); spyOnDev(console, 'error');
// Synchronously render a tree that suspends // Synchronously render a tree that suspends
@ -849,7 +849,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('Async'), span('Sync')]); expect(ReactNoop.getChildren()).toEqual([span('Async'), span('Sync')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspending inside an expired expiration boundary will bubble to the next one', async () => { it('suspending inside an expired expiration boundary will bubble to the next one', async () => {
ReactNoop.flushSync(() => ReactNoop.flushSync(() =>
ReactNoop.render( ReactNoop.render(
@ -873,7 +873,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('Loading (outer)...')]); expect(ReactNoop.getChildren()).toEqual([span('Loading (outer)...')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('expires early by default', async () => { it('expires early by default', async () => {
ReactNoop.render( ReactNoop.render(
<Fragment> <Fragment>
@ -915,7 +915,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('Async'), span('Sync')]); expect(ReactNoop.getChildren()).toEqual([span('Async'), span('Sync')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not expire for transitions', async () => { it('does not expire for transitions', async () => {
ReactNoop.render( ReactNoop.render(
<Fragment> <Fragment>
@ -961,7 +961,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('Async'), span('Sync')]); expect(ReactNoop.getChildren()).toEqual([span('Async'), span('Sync')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('resolves successfully even if fallback render is pending', async () => { it('resolves successfully even if fallback render is pending', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
root.render( root.render(
@ -1011,7 +1011,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache // @gate enableLegacyCache
it('in concurrent mode, does not error when an update suspends without a Suspense boundary during a sync update', () => { it('in concurrent mode, does not error when an update suspends without a Suspense boundary during a sync update', () => {
// NOTE: We may change this to be a warning in the future. // NOTE: We may change this to be a warning in the future.
expect(() => { expect(() => {
@ -1021,7 +1021,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}).not.toThrow(); }).not.toThrow();
}); });
// @gate enableCache // @gate enableLegacyCache
it('in legacy mode, errors when an update suspends without a Suspense boundary during a sync update', () => { it('in legacy mode, errors when an update suspends without a Suspense boundary during a sync update', () => {
const root = ReactNoop.createLegacyRoot(); const root = ReactNoop.createLegacyRoot();
expect(() => root.render(<AsyncText text="Async" />)).toThrow( expect(() => root.render(<AsyncText text="Async" />)).toThrow(
@ -1029,7 +1029,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache // @gate enableLegacyCache
it('a Suspense component correctly handles more than one suspended child', async () => { it('a Suspense component correctly handles more than one suspended child', async () => {
ReactNoop.render( ReactNoop.render(
<Suspense fallback={<Text text="Loading..." />}> <Suspense fallback={<Text text="Loading..." />}>
@ -1051,7 +1051,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('can resume rendering earlier than a timeout', async () => { it('can resume rendering earlier than a timeout', async () => {
ReactNoop.render(<Suspense fallback={<Text text="Loading..." />} />); ReactNoop.render(<Suspense fallback={<Text text="Loading..." />} />);
expect(Scheduler).toFlushAndYield([]); expect(Scheduler).toFlushAndYield([]);
@ -1081,7 +1081,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('Async')]); expect(ReactNoop.getChildren()).toEqual([span('Async')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('starts working on an update even if its priority falls between two suspended levels', async () => { it('starts working on an update even if its priority falls between two suspended levels', async () => {
function App(props) { function App(props) {
return ( return (
@ -1136,7 +1136,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// implementation. It doesn't really test what it was intended to test // implementation. It doesn't really test what it was intended to test
// anymore, because all updates to the same queue get entangled together. // anymore, because all updates to the same queue get entangled together.
// Even if they haven't expired. Consider either deleting or rewriting. // Even if they haven't expired. Consider either deleting or rewriting.
// @gate enableCache // @gate enableLegacyCache
it('flushes all expired updates in a single batch', async () => { it('flushes all expired updates in a single batch', async () => {
class Foo extends React.Component { class Foo extends React.Component {
componentDidUpdate() { componentDidUpdate() {
@ -1179,7 +1179,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('goodbye')]); expect(ReactNoop.getChildren()).toEqual([span('goodbye')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('a suspended update that expires', async () => { it('a suspended update that expires', async () => {
// Regression test. This test used to fall into an infinite loop. // Regression test. This test used to fall into an infinite loop.
function ExpensiveText({text}) { function ExpensiveText({text}) {
@ -1222,7 +1222,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
describe('legacy mode mode', () => { describe('legacy mode mode', () => {
// @gate enableCache // @gate enableLegacyCache
it('times out immediately', async () => { it('times out immediately', async () => {
function App() { function App() {
return ( return (
@ -1245,7 +1245,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('Result')]); expect(ReactNoop.getChildren()).toEqual([span('Result')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('times out immediately when Suspense is in legacy mode', async () => { it('times out immediately when Suspense is in legacy mode', async () => {
class UpdatingText extends React.Component { class UpdatingText extends React.Component {
state = {step: 1}; state = {step: 1};
@ -1319,7 +1319,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not re-render siblings in loose mode', async () => { it('does not re-render siblings in loose mode', async () => {
class TextWithLifecycle extends React.Component { class TextWithLifecycle extends React.Component {
componentDidMount() { componentDidMount() {
@ -1394,7 +1394,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends inside constructor', async () => { it('suspends inside constructor', async () => {
class AsyncTextInConstructor extends React.Component { class AsyncTextInConstructor extends React.Component {
constructor(props) { constructor(props) {
@ -1438,7 +1438,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('Hi')]); expect(ReactNoop.getChildren()).toEqual([span('Hi')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not infinite loop if fallback contains lifecycle method', async () => { it('does not infinite loop if fallback contains lifecycle method', async () => {
class Fallback extends React.Component { class Fallback extends React.Component {
state = { state = {
@ -1481,7 +1481,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
if (global.__PERSISTENT__) { if (global.__PERSISTENT__) {
// @gate enableCache // @gate enableLegacyCache
it('hides/unhides suspended children before layout effects fire (persistent)', async () => { it('hides/unhides suspended children before layout effects fire (persistent)', async () => {
const {useRef, useLayoutEffect} = React; const {useRef, useLayoutEffect} = React;
@ -1525,7 +1525,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(Scheduler).toHaveYielded(['Hi']); expect(Scheduler).toHaveYielded(['Hi']);
}); });
} else { } else {
// @gate enableCache // @gate enableLegacyCache
it('hides/unhides suspended children before layout effects fire (mutation)', async () => { it('hides/unhides suspended children before layout effects fire (mutation)', async () => {
const {useRef, useLayoutEffect} = React; const {useRef, useLayoutEffect} = React;
@ -1570,7 +1570,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
} }
// @gate enableCache // @gate enableLegacyCache
it('handles errors in the return path of a component that suspends', async () => { it('handles errors in the return path of a component that suspends', async () => {
// Covers an edge case where an error is thrown inside the complete phase // Covers an edge case where an error is thrown inside the complete phase
// of a component that is in the return path of a component that suspends. // of a component that is in the return path of a component that suspends.
@ -1655,7 +1655,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not call lifecycles of a suspended component', async () => { it('does not call lifecycles of a suspended component', async () => {
class TextWithLifecycle extends React.Component { class TextWithLifecycle extends React.Component {
componentDidMount() { componentDidMount() {
@ -1725,7 +1725,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not call lifecycles of a suspended component (hooks)', async () => { it('does not call lifecycles of a suspended component (hooks)', async () => {
function TextWithLifecycle(props) { function TextWithLifecycle(props) {
React.useLayoutEffect(() => { React.useLayoutEffect(() => {
@ -1861,7 +1861,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
]); ]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('suspends for longer if something took a long (CPU bound) time to render', async () => { it('suspends for longer if something took a long (CPU bound) time to render', async () => {
function Foo({renderContent}) { function Foo({renderContent}) {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -1929,7 +1929,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A')]); expect(ReactNoop.getChildren()).toEqual([span('A')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not suspends if a fallback has been shown for a long time', async () => { it('does not suspends if a fallback has been shown for a long time', async () => {
function Foo() { function Foo() {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -1983,7 +1983,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('does suspend if a fallback has been shown for a short time', async () => { it('does suspend if a fallback has been shown for a short time', async () => {
function Foo() { function Foo() {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -2033,7 +2033,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not suspend for very long after a higher priority update', async () => { it('does not suspend for very long after a higher priority update', async () => {
function Foo({renderContent}) { function Foo({renderContent}) {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -2087,7 +2087,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
// TODO: flip to "warns" when this is implemented again. // TODO: flip to "warns" when this is implemented again.
// @gate enableCache // @gate enableLegacyCache
it('does not warn when a low priority update suspends inside a high priority update for functional components', async () => { it('does not warn when a low priority update suspends inside a high priority update for functional components', async () => {
let _setShow; let _setShow;
function App() { function App() {
@ -2111,7 +2111,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
// TODO: flip to "warns" when this is implemented again. // TODO: flip to "warns" when this is implemented again.
// @gate enableCache // @gate enableLegacyCache
it('does not warn when a low priority update suspends inside a high priority update for class components', async () => { it('does not warn when a low priority update suspends inside a high priority update for class components', async () => {
let show; let show;
class App extends React.Component { class App extends React.Component {
@ -2137,7 +2137,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not warn about wrong Suspense priority if no new fallbacks are shown', async () => { it('does not warn about wrong Suspense priority if no new fallbacks are shown', async () => {
let showB; let showB;
class App extends React.Component { class App extends React.Component {
@ -2169,7 +2169,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
// TODO: flip to "warns" when this is implemented again. // TODO: flip to "warns" when this is implemented again.
// @gate enableCache // @gate enableLegacyCache
it( it(
'does not warn when component that triggered user-blocking update is between Suspense boundary ' + 'does not warn when component that triggered user-blocking update is between Suspense boundary ' +
'and component that suspended', 'and component that suspended',
@ -2198,7 +2198,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
it('normal priority updates suspending do not warn for class components', async () => { it('normal priority updates suspending do not warn for class components', async () => {
let show; let show;
class App extends React.Component { class App extends React.Component {
@ -2227,7 +2227,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop).toMatchRenderedOutput('Loading...'); expect(ReactNoop).toMatchRenderedOutput('Loading...');
}); });
// @gate enableCache // @gate enableLegacyCache
it('normal priority updates suspending do not warn for functional components', async () => { it('normal priority updates suspending do not warn for functional components', async () => {
let _setShow; let _setShow;
function App() { function App() {
@ -2253,7 +2253,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop).toMatchRenderedOutput('Loading...'); expect(ReactNoop).toMatchRenderedOutput('Loading...');
}); });
// @gate enableCache && enableSuspenseAvoidThisFallback // @gate enableLegacyCache && enableSuspenseAvoidThisFallback
it('shows the parent fallback if the inner fallback should be avoided', async () => { it('shows the parent fallback if the inner fallback should be avoided', async () => {
function Foo({showC}) { function Foo({showC}) {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -2310,7 +2310,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('C'), span('B')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('C'), span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('does not show the parent fallback if the inner fallback is not defined', async () => { it('does not show the parent fallback if the inner fallback is not defined', async () => {
function Foo({showC}) { function Foo({showC}) {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -2359,7 +2359,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('C'), span('B')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('C'), span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('favors showing the inner fallback for nested top level avoided fallback', async () => { it('favors showing the inner fallback for nested top level avoided fallback', async () => {
function Foo({showB}) { function Foo({showB}) {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -2391,7 +2391,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('A'), span('Loading B...')]); expect(ReactNoop.getChildren()).toEqual([span('A'), span('Loading B...')]);
}); });
// @gate enableCache && enableSuspenseAvoidThisFallback // @gate enableLegacyCache && enableSuspenseAvoidThisFallback
it('keeps showing an avoided parent fallback if it is already showing', async () => { it('keeps showing an avoided parent fallback if it is already showing', async () => {
function Foo({showB}) { function Foo({showB}) {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -2449,7 +2449,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
} }
}); });
// @gate enableCache // @gate enableLegacyCache
it('keeps showing an undefined fallback if it is already showing', async () => { it('keeps showing an undefined fallback if it is already showing', async () => {
function Foo({showB}) { function Foo({showB}) {
Scheduler.unstable_yieldValue('Foo'); Scheduler.unstable_yieldValue('Foo');
@ -2500,7 +2500,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
} }
}); });
// @gate enableCache // @gate enableLegacyCache
it('commits a suspended idle pri render within a reasonable time', async () => { it('commits a suspended idle pri render within a reasonable time', async () => {
function Foo({renderContent}) { function Foo({renderContent}) {
return ( return (
@ -2549,7 +2549,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
describe('startTransition', () => { describe('startTransition', () => {
// @gate enableCache // @gate enableLegacyCache
it('top level render', async () => { it('top level render', async () => {
function App({page}) { function App({page}) {
return ( return (
@ -2588,7 +2588,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('B')]); expect(ReactNoop.getChildren()).toEqual([span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('hooks', async () => { it('hooks', async () => {
let transitionToPage; let transitionToPage;
function App() { function App() {
@ -2640,7 +2640,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('B')]); expect(ReactNoop.getChildren()).toEqual([span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('classes', async () => { it('classes', async () => {
let transitionToPage; let transitionToPage;
class App extends React.Component { class App extends React.Component {
@ -2697,7 +2697,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
describe('delays transitions when using React.startTransition', () => { describe('delays transitions when using React.startTransition', () => {
// @gate enableCache // @gate enableLegacyCache
it('top level render', async () => { it('top level render', async () => {
function App({page}) { function App({page}) {
return ( return (
@ -2747,7 +2747,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(ReactNoop.getChildren()).toEqual([span('B')]); expect(ReactNoop.getChildren()).toEqual([span('B')]);
}); });
// @gate enableCache // @gate enableLegacyCache
it('hooks', async () => { it('hooks', async () => {
let transitionToPage; let transitionToPage;
function App() { function App() {
@ -2814,7 +2814,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
}); });
// @gate enableCache // @gate enableLegacyCache
it('classes', async () => { it('classes', async () => {
let transitionToPage; let transitionToPage;
class App extends React.Component { class App extends React.Component {
@ -2884,7 +2884,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
}); });
// @gate enableCache && enableSuspenseAvoidThisFallback // @gate enableLegacyCache && enableSuspenseAvoidThisFallback
it('do not show placeholder when updating an avoided boundary with startTransition', async () => { it('do not show placeholder when updating an avoided boundary with startTransition', async () => {
function App({page}) { function App({page}) {
return ( return (
@ -2928,7 +2928,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache && enableSuspenseAvoidThisFallback // @gate enableLegacyCache && enableSuspenseAvoidThisFallback
it('do not show placeholder when mounting an avoided boundary with startTransition', async () => { it('do not show placeholder when mounting an avoided boundary with startTransition', async () => {
function App({page}) { function App({page}) {
return ( return (
@ -2981,7 +2981,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
// TODO: This test is specifically about avoided commits that suspend for a // TODO: This test is specifically about avoided commits that suspend for a
// JND. We may remove this behavior. // JND. We may remove this behavior.
// @gate enableCache // @gate enableLegacyCache
it("suspended commit remains suspended even if there's another update at same expiration", async () => { it("suspended commit remains suspended even if there's another update at same expiration", async () => {
// Regression test // Regression test
function App({text}) { function App({text}) {
@ -3088,7 +3088,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(root).toMatchRenderedOutput(<span prop="Foo" />); expect(root).toMatchRenderedOutput(<span prop="Foo" />);
}); });
// @gate enableCache && enableLegacyHidden // @gate enableLegacyCache && enableLegacyHidden
it('should not render hidden content while suspended on higher pri', async () => { it('should not render hidden content while suspended on higher pri', async () => {
function Offscreen() { function Offscreen() {
Scheduler.unstable_yieldValue('Offscreen'); Scheduler.unstable_yieldValue('Offscreen');
@ -3138,7 +3138,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache && enableLegacyHidden // @gate enableLegacyCache && enableLegacyHidden
it('should be able to unblock higher pri content before suspended hidden', async () => { it('should be able to unblock higher pri content before suspended hidden', async () => {
function Offscreen() { function Offscreen() {
Scheduler.unstable_yieldValue('Offscreen'); Scheduler.unstable_yieldValue('Offscreen');
@ -3193,7 +3193,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache // @gate enableLegacyCache
it( it(
'multiple updates originating inside a Suspense boundary at different ' + 'multiple updates originating inside a Suspense boundary at different ' +
'priority levels are not dropped', 'priority levels are not dropped',
@ -3247,7 +3247,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
it( it(
'multiple updates originating inside a Suspense boundary at different ' + 'multiple updates originating inside a Suspense boundary at different ' +
'priority levels are not dropped, including Idle updates', 'priority levels are not dropped, including Idle updates',
@ -3312,7 +3312,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
it( it(
'fallback component can update itself even after a high pri update to ' + 'fallback component can update itself even after a high pri update to ' +
'the primary tree suspends', 'the primary tree suspends',
@ -3397,7 +3397,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
it( it(
'regression: primary fragment fiber is not always part of setState ' + 'regression: primary fragment fiber is not always part of setState ' +
'return path', 'return path',
@ -3476,7 +3476,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
it( it(
'regression: primary fragment fiber is not always part of setState ' + 'regression: primary fragment fiber is not always part of setState ' +
'return path (another case)', 'return path (another case)',
@ -3558,7 +3558,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
it( it(
'after showing fallback, should not flip back to primary content until ' + 'after showing fallback, should not flip back to primary content until ' +
'the update that suspended finishes', 'the update that suspended finishes',
@ -3702,7 +3702,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
it('a high pri update can unhide a boundary that suspended at a different level', async () => { it('a high pri update can unhide a boundary that suspended at a different level', async () => {
const {useState, useEffect} = React; const {useState, useEffect} = React;
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
@ -3799,7 +3799,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache // @gate enableLegacyCache
// @gate !enableSyncDefaultUpdates // @gate !enableSyncDefaultUpdates
it('regression: ping at high priority causes update to be dropped', async () => { it('regression: ping at high priority causes update to be dropped', async () => {
const {useState, useTransition} = React; const {useState, useTransition} = React;
@ -3911,7 +3911,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
// Regression: https://github.com/facebook/react/issues/18486 // Regression: https://github.com/facebook/react/issues/18486
// @gate enableCache // @gate enableLegacyCache
it('does not get stuck in pending state with render phase updates', async () => { it('does not get stuck in pending state with render phase updates', async () => {
let setTextWithShortTransition; let setTextWithShortTransition;
let setTextWithLongTransition; let setTextWithLongTransition;
@ -4021,7 +4021,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
}); });
}); });
// @gate enableCache // @gate enableLegacyCache
it('regression: #18657', async () => { it('regression: #18657', async () => {
const {useState} = React; const {useState} = React;
@ -4068,7 +4068,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(root).toMatchRenderedOutput(<span prop="B" />); expect(root).toMatchRenderedOutput(<span prop="B" />);
}); });
// @gate enableCache // @gate enableLegacyCache
it('retries have lower priority than normal updates', async () => { it('retries have lower priority than normal updates', async () => {
const {useState} = React; const {useState} = React;
@ -4123,7 +4123,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
); );
}); });
// @gate enableCache // @gate enableLegacyCache
it('should fire effect clean-up when deleting suspended tree', async () => { it('should fire effect clean-up when deleting suspended tree', async () => {
const {useEffect} = React; const {useEffect} = React;
@ -4171,7 +4171,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
expect(Scheduler).toHaveYielded(['Unmount Child']); expect(Scheduler).toHaveYielded(['Unmount Child']);
}); });
// @gate enableCache // @gate enableLegacyCache
it('should fire effect clean-up when deleting suspended tree (legacy)', async () => { it('should fire effect clean-up when deleting suspended tree (legacy)', async () => {
const {useEffect} = React; const {useEffect} = React;

View File

@ -16,7 +16,7 @@ describe('ReactThenable', () => {
ReactNoop = require('react-noop-renderer'); ReactNoop = require('react-noop-renderer');
Scheduler = require('scheduler'); Scheduler = require('scheduler');
act = require('jest-react').act; act = require('jest-react').act;
use = React.experimental_use; use = React.use;
Suspense = React.Suspense; Suspense = React.Suspense;
startTransition = React.startTransition; startTransition = React.startTransition;
}); });

View File

@ -158,7 +158,7 @@ describe('ReactTransition', () => {
} }
} }
// @gate enableCache // @gate enableLegacyCache
test('isPending works even if called from outside an input event', async () => { test('isPending works even if called from outside an input event', async () => {
let start; let start;
function App() { function App() {
@ -199,7 +199,7 @@ describe('ReactTransition', () => {
expect(root).toMatchRenderedOutput('Async'); expect(root).toMatchRenderedOutput('Async');
}); });
// @gate enableCache // @gate enableLegacyCache
test( test(
'when multiple transitions update the same queue, only the most recent ' + 'when multiple transitions update the same queue, only the most recent ' +
'one is allowed to finish (no intermediate states)', 'one is allowed to finish (no intermediate states)',
@ -318,7 +318,7 @@ describe('ReactTransition', () => {
); );
// Same as previous test, but for class update queue. // Same as previous test, but for class update queue.
// @gate enableCache // @gate enableLegacyCache
test( test(
'when multiple transitions update the same queue, only the most recent ' + 'when multiple transitions update the same queue, only the most recent ' +
'one is allowed to finish (no intermediate states) (classes)', 'one is allowed to finish (no intermediate states) (classes)',
@ -442,7 +442,7 @@ describe('ReactTransition', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
test( test(
'when multiple transitions update overlapping queues, all the transitions ' + 'when multiple transitions update overlapping queues, all the transitions ' +
'across all the queues are entangled', 'across all the queues are entangled',
@ -547,7 +547,7 @@ describe('ReactTransition', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
test('interrupt a refresh transition if a new transition is scheduled', async () => { test('interrupt a refresh transition if a new transition is scheduled', async () => {
const root = ReactNoop.createRoot(); const root = ReactNoop.createRoot();
@ -602,7 +602,7 @@ describe('ReactTransition', () => {
expect(root).toMatchRenderedOutput('Updated'); expect(root).toMatchRenderedOutput('Updated');
}); });
// @gate enableCache // @gate enableLegacyCache
test( test(
"interrupt a refresh transition when something suspends and we've " + "interrupt a refresh transition when something suspends and we've " +
'already bailed out on another transition in a parent', 'already bailed out on another transition in a parent',
@ -704,7 +704,7 @@ describe('ReactTransition', () => {
}, },
); );
// @gate enableCache // @gate enableLegacyCache
test( test(
'interrupt a refresh transition when something suspends and a parent ' + 'interrupt a refresh transition when something suspends and a parent ' +
'component received an interleaved update after its queue was processed', 'component received an interleaved update after its queue was processed',
@ -824,7 +824,7 @@ describe('ReactTransition', () => {
expect(root).toMatchRenderedOutput('Transition pri: 1, Normal pri: 1'); expect(root).toMatchRenderedOutput('Transition pri: 1, Normal pri: 1');
}); });
// @gate enableCache // @gate enableLegacyCache
it('should render normal pri updates before transition suspense retries', async () => { it('should render normal pri updates before transition suspense retries', async () => {
let updateTransitionPri; let updateTransitionPri;
let updateNormalPri; let updateNormalPri;

View File

@ -1,7 +1,7 @@
{ {
"name": "react-server-dom-webpack", "name": "react-server-dom-webpack",
"description": "React Server Components bindings for DOM using Webpack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.", "description": "React Server Components bindings for DOM using Webpack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
"version": "0.1.0", "version": "18.2.0",
"keywords": [ "keywords": [
"react" "react"
], ],
@ -50,8 +50,8 @@
"node": ">=0.10.0" "node": ">=0.10.0"
}, },
"peerDependencies": { "peerDependencies": {
"react": "^17.0.0", "react": "^18.2.0",
"react-dom": "^17.0.0", "react-dom": "^18.2.0",
"webpack": "^5.59.0" "webpack": "^5.59.0"
}, },
"dependencies": { "dependencies": {

View File

@ -41,7 +41,7 @@ describe('ReactFlightDOM', () => {
Stream = require('stream'); Stream = require('stream');
React = require('react'); React = require('react');
use = React.experimental_use; use = React.use;
Suspense = React.Suspense; Suspense = React.Suspense;
ReactDOMClient = require('react-dom/client'); ReactDOMClient = require('react-dom/client');
ReactServerDOMWriter = require('react-server-dom-webpack/server.node'); ReactServerDOMWriter = require('react-server-dom-webpack/server.node');

View File

@ -40,7 +40,7 @@ describe('ReactFlightDOMBrowser', () => {
ReactServerDOMWriter = require('react-server-dom-webpack/server.browser'); ReactServerDOMWriter = require('react-server-dom-webpack/server.browser');
ReactServerDOMReader = require('react-server-dom-webpack/client'); ReactServerDOMReader = require('react-server-dom-webpack/client');
Suspense = React.Suspense; Suspense = React.Suspense;
use = React.experimental_use; use = React.use;
}); });
async function readResult(stream) { async function readResult(stream) {

View File

@ -27,12 +27,12 @@ export {
createMutableSource as unstable_createMutableSource, createMutableSource as unstable_createMutableSource,
createRef, createRef,
createServerContext, createServerContext,
experimental_use, use,
forwardRef, forwardRef,
isValidElement, isValidElement,
lazy, lazy,
memo, memo,
experimental_cache, cache,
startTransition, startTransition,
startTransition as unstable_startTransition, // TODO: Remove once call sights updated to startTransition startTransition as unstable_startTransition, // TODO: Remove once call sights updated to startTransition
unstable_Cache, unstable_Cache,

View File

@ -24,12 +24,12 @@ export {
createFactory, createFactory,
createRef, createRef,
createServerContext, createServerContext,
experimental_use, use,
forwardRef, forwardRef,
isValidElement, isValidElement,
lazy, lazy,
memo, memo,
experimental_cache, cache,
startTransition, startTransition,
unstable_Cache, unstable_Cache,
unstable_DebugTracingMode, unstable_DebugTracingMode,

View File

@ -49,12 +49,12 @@ export {
createMutableSource, createMutableSource,
createRef, createRef,
createServerContext, createServerContext,
experimental_use, use,
forwardRef, forwardRef,
isValidElement, isValidElement,
lazy, lazy,
memo, memo,
experimental_cache, cache,
startTransition, startTransition,
unstable_Cache, unstable_Cache,
unstable_DebugTracingMode, unstable_DebugTracingMode,

View File

@ -26,12 +26,12 @@ export {
createMutableSource as unstable_createMutableSource, createMutableSource as unstable_createMutableSource,
createRef, createRef,
createServerContext, createServerContext,
experimental_use, use,
forwardRef, forwardRef,
isValidElement, isValidElement,
lazy, lazy,
memo, memo,
experimental_cache, cache,
startTransition, startTransition,
startTransition as unstable_startTransition, // TODO: Remove once call sights updated to startTransition startTransition as unstable_startTransition, // TODO: Remove once call sights updated to startTransition
unstable_Cache, unstable_Cache,

View File

@ -22,10 +22,14 @@ export {
createElement, createElement,
createFactory, createFactory,
createRef, createRef,
createServerContext,
use,
forwardRef, forwardRef,
isValidElement, isValidElement,
lazy, lazy,
memo, memo,
cache,
unstable_useCacheRefresh,
startTransition, startTransition,
useId, useId,
useCallback, useCallback,
@ -33,7 +37,6 @@ export {
useDebugValue, useDebugValue,
useDeferredValue, useDeferredValue,
useEffect, useEffect,
experimental_useEvent,
useImperativeHandle, useImperativeHandle,
useInsertionEffect, useInsertionEffect,
useLayoutEffect, useLayoutEffect,

View File

@ -101,7 +101,7 @@ export {
forwardRef, forwardRef,
lazy, lazy,
memo, memo,
cache as experimental_cache, cache,
useCallback, useCallback,
useContext, useContext,
useEffect, useEffect,
@ -139,7 +139,7 @@ export {
getCacheForType as unstable_getCacheForType, getCacheForType as unstable_getCacheForType,
useCacheRefresh as unstable_useCacheRefresh, useCacheRefresh as unstable_useCacheRefresh,
REACT_CACHE_TYPE as unstable_Cache, REACT_CACHE_TYPE as unstable_Cache,
use as experimental_use, use,
useMemoCache as unstable_useMemoCache, useMemoCache as unstable_useMemoCache,
// enableScopeAPI // enableScopeAPI
REACT_SCOPE_TYPE as unstable_Scope, REACT_SCOPE_TYPE as unstable_Scope,

View File

@ -22,12 +22,12 @@ export {
createElement, createElement,
createRef, createRef,
createServerContext, createServerContext,
experimental_use, use,
forwardRef, forwardRef,
isValidElement, isValidElement,
lazy, lazy,
memo, memo,
experimental_cache, cache,
startTransition, startTransition,
unstable_DebugTracingMode, unstable_DebugTracingMode,
unstable_getCacheSignal, unstable_getCacheSignal,

View File

@ -7,7 +7,31 @@
* @flow * @flow
*/ */
// eslint-disable-next-line react-internal/prod-error-codes // Patch fetch
throw new Error( import './ReactFetch';
'This entry point is not yet supported outside of experimental channels',
); export {
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
Children,
Fragment,
Profiler,
StrictMode,
Suspense,
cloneElement,
createElement,
createRef,
createServerContext,
use,
forwardRef,
isValidElement,
lazy,
memo,
cache,
startTransition,
useId,
useCallback,
useContext,
useDebugValue,
useMemo,
version,
} from './React';

View File

@ -44,14 +44,15 @@ describe('ReactFetch', () => {
fetchCount = 0; fetchCount = 0;
global.fetch = fetchMock; global.fetch = fetchMock;
if (gate(flags => flags.experimental && !flags.www)) { if (gate(flags => !flags.www)) {
jest.mock('react', () => require('react/react.shared-subset')); jest.mock('react', () => require('react/react.shared-subset'));
} }
React = require('react'); React = require('react');
ReactServerDOMServer = require('react-server-dom-webpack/server.browser'); ReactServerDOMServer = require('react-server-dom-webpack/server.browser');
ReactServerDOMClient = require('react-server-dom-webpack/client'); ReactServerDOMClient = require('react-server-dom-webpack/client');
use = React.experimental_use; use = React.use;
cache = React.experimental_cache; cache = React.cache;
}); });
async function render(Component) { async function render(Component) {

View File

@ -82,9 +82,10 @@ export const enableLegacyFBSupport = false;
// likely to include in an upcoming release. // likely to include in an upcoming release.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
export const enableCache = __EXPERIMENTAL__; export const enableCache = true;
export const enableLegacyCache = __EXPERIMENTAL__;
export const enableCacheElement = __EXPERIMENTAL__; export const enableCacheElement = __EXPERIMENTAL__;
export const enableFetchInstrumentation = __EXPERIMENTAL__; export const enableFetchInstrumentation = true;
export const enableTransitionTracing = false; export const enableTransitionTracing = false;
@ -101,9 +102,9 @@ export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = __EXPERIMENTAL__; export const enableCPUSuspense = __EXPERIMENTAL__;
export const enableHostSingletons = __EXPERIMENTAL__; export const enableHostSingletons = true;
export const enableFloat = __EXPERIMENTAL__; export const enableFloat = true;
// When a node is unmounted, recurse into the Fiber subtree and clean out // When a node is unmounted, recurse into the Fiber subtree and clean out
// references. Each level cleans up more fiber fields than the previous level. // references. Each level cleans up more fiber fields than the previous level.
@ -118,7 +119,7 @@ export const enableFloat = __EXPERIMENTAL__;
// aggressiveness. // aggressiveness.
export const deletedTreeCleanUpLevel = 3; export const deletedTreeCleanUpLevel = 3;
export const enableUseHook = __EXPERIMENTAL__; export const enableUseHook = true;
// Enables unstable_useMemoCache hook, intended as a compilation target for // Enables unstable_useMemoCache hook, intended as a compilation target for
// auto-memoization. // auto-memoization.
@ -253,7 +254,7 @@ export const enableUpdaterTracking = __PROFILE__;
// Only enabled in RN, related to enableComponentStackLocations // Only enabled in RN, related to enableComponentStackLocations
export const disableNativeComponentFrames = false; export const disableNativeComponentFrames = false;
export const enableServerContext = __EXPERIMENTAL__; export const enableServerContext = true;
// Internal only. // Internal only.
export const enableGetInspectorDataForInstanceInProduction = false; export const enableGetInspectorDataForInstanceInProduction = false;

View File

@ -28,6 +28,7 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableProfilerNestedUpdateScheduledHook = false; export const enableProfilerNestedUpdateScheduledHook = false;
export const enableUpdaterTracking = __PROFILE__; export const enableUpdaterTracking = __PROFILE__;
export const enableCache = false; export const enableCache = false;
export const enableLegacyCache = false;
export const enableCacheElement = true; export const enableCacheElement = true;
export const enableFetchInstrumentation = false; export const enableFetchInstrumentation = false;
export const enableSchedulerDebugging = false; export const enableSchedulerDebugging = false;
@ -51,7 +52,7 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallback = false;
export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = true; export const enableCPUSuspense = true;
export const enableUseHook = false; export const enableUseHook = true;
export const enableUseMemoCacheHook = true; export const enableUseMemoCacheHook = true;
export const enableUseEventHook = false; export const enableUseEventHook = false;
export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true;
@ -76,14 +77,14 @@ export const allowConcurrentByDefault = true;
export const enableCustomElementPropertySupport = false; export const enableCustomElementPropertySupport = false;
export const consoleManagedByDevToolsDuringStrictMode = false; export const consoleManagedByDevToolsDuringStrictMode = false;
export const enableServerContext = false; export const enableServerContext = true;
export const enableUseMutableSource = true; export const enableUseMutableSource = true;
export const enableTransitionTracing = false; export const enableTransitionTracing = false;
export const enableFloat = false; export const enableFloat = true;
export const enableHostSingletons = false; export const enableHostSingletons = true;
export const useModernStrictMode = false; export const useModernStrictMode = false;
export const enableFizzExternalRuntime = false; export const enableFizzExternalRuntime = false;

View File

@ -21,6 +21,7 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableProfilerNestedUpdateScheduledHook = false; export const enableProfilerNestedUpdateScheduledHook = false;
export const enableUpdaterTracking = __PROFILE__; export const enableUpdaterTracking = __PROFILE__;
export const enableCache = false; export const enableCache = false;
export const enableLegacyCache = false;
export const enableCacheElement = false; export const enableCacheElement = false;
export const enableFetchInstrumentation = false; export const enableFetchInstrumentation = false;
export const disableJavaScriptURLs = false; export const disableJavaScriptURLs = false;
@ -41,7 +42,7 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallback = false;
export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = false; export const enableCPUSuspense = false;
export const enableUseHook = false; export const enableUseHook = true;
export const enableUseMemoCacheHook = false; export const enableUseMemoCacheHook = false;
export const enableUseEventHook = false; export const enableUseEventHook = false;
export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true;
@ -67,13 +68,13 @@ export const allowConcurrentByDefault = false;
export const enableCustomElementPropertySupport = false; export const enableCustomElementPropertySupport = false;
export const consoleManagedByDevToolsDuringStrictMode = false; export const consoleManagedByDevToolsDuringStrictMode = false;
export const enableServerContext = false; export const enableServerContext = true;
export const enableUseMutableSource = false; export const enableUseMutableSource = false;
export const enableTransitionTracing = false; export const enableTransitionTracing = false;
export const enableFloat = false; export const enableFloat = true;
export const enableHostSingletons = false; export const enableHostSingletons = true;
export const useModernStrictMode = false; export const useModernStrictMode = false;
export const enableFizzExternalRuntime = false; export const enableFizzExternalRuntime = false;

View File

@ -20,9 +20,10 @@ export const enableProfilerCommitHooks = __PROFILE__;
export const enableProfilerNestedUpdatePhase = __PROFILE__; export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableProfilerNestedUpdateScheduledHook = false; export const enableProfilerNestedUpdateScheduledHook = false;
export const enableUpdaterTracking = false; export const enableUpdaterTracking = false;
export const enableCache = __EXPERIMENTAL__; export const enableCache = true;
export const enableLegacyCache = __EXPERIMENTAL__;
export const enableCacheElement = __EXPERIMENTAL__; export const enableCacheElement = __EXPERIMENTAL__;
export const enableFetchInstrumentation = __EXPERIMENTAL__; export const enableFetchInstrumentation = true;
export const disableJavaScriptURLs = false; export const disableJavaScriptURLs = false;
export const disableCommentsAsDOMContainers = true; export const disableCommentsAsDOMContainers = true;
export const disableInputAttributeSyncing = false; export const disableInputAttributeSyncing = false;
@ -41,7 +42,7 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallback = false;
export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = false; export const enableCPUSuspense = false;
export const enableUseHook = false; export const enableUseHook = true;
export const enableUseMemoCacheHook = false; export const enableUseMemoCacheHook = false;
export const enableUseEventHook = false; export const enableUseEventHook = false;
export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true;
@ -67,13 +68,13 @@ export const allowConcurrentByDefault = false;
export const enableCustomElementPropertySupport = false; export const enableCustomElementPropertySupport = false;
export const consoleManagedByDevToolsDuringStrictMode = false; export const consoleManagedByDevToolsDuringStrictMode = false;
export const enableServerContext = false; export const enableServerContext = true;
export const enableUseMutableSource = false; export const enableUseMutableSource = false;
export const enableTransitionTracing = false; export const enableTransitionTracing = false;
export const enableFloat = false; export const enableFloat = true;
export const enableHostSingletons = false; export const enableHostSingletons = true;
export const useModernStrictMode = false; export const useModernStrictMode = false;
export const enableFizzExternalRuntime = false; export const enableFizzExternalRuntime = false;

View File

@ -21,6 +21,7 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableProfilerNestedUpdateScheduledHook = false; export const enableProfilerNestedUpdateScheduledHook = false;
export const enableUpdaterTracking = false; export const enableUpdaterTracking = false;
export const enableCache = true; export const enableCache = true;
export const enableLegacyCache = false;
export const enableCacheElement = true; export const enableCacheElement = true;
export const enableFetchInstrumentation = false; export const enableFetchInstrumentation = false;
export const disableJavaScriptURLs = false; export const disableJavaScriptURLs = false;
@ -50,7 +51,7 @@ export const deferRenderPhaseUpdateToNextBatch = false;
export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallback = false;
export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = false; export const enableCPUSuspense = false;
export const enableUseHook = false; export const enableUseHook = true;
export const enableUseMemoCacheHook = false; export const enableUseMemoCacheHook = false;
export const enableUseEventHook = false; export const enableUseEventHook = false;
export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true;
@ -65,13 +66,13 @@ export const enableSyncDefaultUpdates = true;
export const allowConcurrentByDefault = true; export const allowConcurrentByDefault = true;
export const consoleManagedByDevToolsDuringStrictMode = false; export const consoleManagedByDevToolsDuringStrictMode = false;
export const enableServerContext = false; export const enableServerContext = true;
export const enableUseMutableSource = false; export const enableUseMutableSource = false;
export const enableTransitionTracing = false; export const enableTransitionTracing = false;
export const enableFloat = false; export const enableFloat = true;
export const enableHostSingletons = false; export const enableHostSingletons = true;
export const useModernStrictMode = false; export const useModernStrictMode = false;

View File

@ -21,6 +21,7 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableProfilerNestedUpdateScheduledHook = false; export const enableProfilerNestedUpdateScheduledHook = false;
export const enableUpdaterTracking = false; export const enableUpdaterTracking = false;
export const enableCache = true; export const enableCache = true;
export const enableLegacyCache = true;
export const enableCacheElement = true; export const enableCacheElement = true;
export const enableFetchInstrumentation = false; export const enableFetchInstrumentation = false;
export const enableSchedulerDebugging = false; export const enableSchedulerDebugging = false;
@ -41,7 +42,7 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableSuspenseAvoidThisFallback = true; export const enableSuspenseAvoidThisFallback = true;
export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = false; export const enableCPUSuspense = false;
export const enableUseHook = false; export const enableUseHook = true;
export const enableUseMemoCacheHook = false; export const enableUseMemoCacheHook = false;
export const enableUseEventHook = false; export const enableUseEventHook = false;
export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true;
@ -67,15 +68,15 @@ export const allowConcurrentByDefault = true;
export const enableCustomElementPropertySupport = false; export const enableCustomElementPropertySupport = false;
export const consoleManagedByDevToolsDuringStrictMode = false; export const consoleManagedByDevToolsDuringStrictMode = false;
export const enableServerContext = false; export const enableServerContext = true;
// Some www surfaces are still using this. Remove once they have been migrated. // Some www surfaces are still using this. Remove once they have been migrated.
export const enableUseMutableSource = true; export const enableUseMutableSource = true;
export const enableTransitionTracing = false; export const enableTransitionTracing = false;
export const enableFloat = false; export const enableFloat = true;
export const enableHostSingletons = false; export const enableHostSingletons = true;
export const useModernStrictMode = false; export const useModernStrictMode = false;
export const enableFizzExternalRuntime = false; export const enableFizzExternalRuntime = false;

View File

@ -21,6 +21,7 @@ export const enableProfilerNestedUpdatePhase = __PROFILE__;
export const enableProfilerNestedUpdateScheduledHook = false; export const enableProfilerNestedUpdateScheduledHook = false;
export const enableUpdaterTracking = false; export const enableUpdaterTracking = false;
export const enableCache = __EXPERIMENTAL__; export const enableCache = __EXPERIMENTAL__;
export const enableLegacyCache = __EXPERIMENTAL__;
export const enableCacheElement = __EXPERIMENTAL__; export const enableCacheElement = __EXPERIMENTAL__;
export const enableFetchInstrumentation = __EXPERIMENTAL__; export const enableFetchInstrumentation = __EXPERIMENTAL__;
export const disableJavaScriptURLs = false; export const disableJavaScriptURLs = false;
@ -41,7 +42,7 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableSuspenseAvoidThisFallback = false; export const enableSuspenseAvoidThisFallback = false;
export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = false; export const enableCPUSuspense = false;
export const enableUseHook = false; export const enableUseHook = true;
export const enableUseMemoCacheHook = false; export const enableUseMemoCacheHook = false;
export const enableUseEventHook = false; export const enableUseEventHook = false;
export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true;
@ -67,13 +68,13 @@ export const allowConcurrentByDefault = false;
export const enableCustomElementPropertySupport = false; export const enableCustomElementPropertySupport = false;
export const consoleManagedByDevToolsDuringStrictMode = false; export const consoleManagedByDevToolsDuringStrictMode = false;
export const enableServerContext = false; export const enableServerContext = true;
export const enableUseMutableSource = false; export const enableUseMutableSource = false;
export const enableTransitionTracing = false; export const enableTransitionTracing = false;
export const enableFloat = false; export const enableFloat = true;
export const enableHostSingletons = false; export const enableHostSingletons = true;
export const useModernStrictMode = false; export const useModernStrictMode = false;
export const enableFizzExternalRuntime = false; export const enableFizzExternalRuntime = false;

View File

@ -21,6 +21,7 @@ export const enableProfilerNestedUpdatePhase = false;
export const enableProfilerNestedUpdateScheduledHook = false; export const enableProfilerNestedUpdateScheduledHook = false;
export const enableUpdaterTracking = false; export const enableUpdaterTracking = false;
export const enableCache = true; export const enableCache = true;
export const enableLegacyCache = true;
export const enableCacheElement = true; export const enableCacheElement = true;
export const enableFetchInstrumentation = false; export const enableFetchInstrumentation = false;
export const disableJavaScriptURLs = true; export const disableJavaScriptURLs = true;
@ -41,7 +42,7 @@ export const warnAboutSpreadingKeyToJSX = false;
export const enableSuspenseAvoidThisFallback = true; export const enableSuspenseAvoidThisFallback = true;
export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = true; export const enableCPUSuspense = true;
export const enableUseHook = false; export const enableUseHook = true;
export const enableUseMemoCacheHook = false; export const enableUseMemoCacheHook = false;
export const enableUseEventHook = false; export const enableUseEventHook = false;
export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true; export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = true;
@ -67,14 +68,14 @@ export const allowConcurrentByDefault = true;
export const enableCustomElementPropertySupport = false; export const enableCustomElementPropertySupport = false;
export const consoleManagedByDevToolsDuringStrictMode = false; export const consoleManagedByDevToolsDuringStrictMode = false;
export const enableServerContext = false; export const enableServerContext = true;
// Some www surfaces are still using this. Remove once they have been migrated. // Some www surfaces are still using this. Remove once they have been migrated.
export const enableUseMutableSource = true; export const enableUseMutableSource = true;
export const enableTransitionTracing = false; export const enableTransitionTracing = false;
export const enableFloat = false; export const enableFloat = true;
export const enableHostSingletons = false; export const enableHostSingletons = true;
export const useModernStrictMode = false; export const useModernStrictMode = false;
export const enableFizzExternalRuntime = false; export const enableFizzExternalRuntime = false;

View File

@ -50,11 +50,11 @@ export const enableUpdaterTracking = __PROFILE__;
export const enableSuspenseAvoidThisFallback = true; export const enableSuspenseAvoidThisFallback = true;
export const enableSuspenseAvoidThisFallbackFizz = false; export const enableSuspenseAvoidThisFallbackFizz = false;
export const enableCPUSuspense = true; export const enableCPUSuspense = true;
export const enableFloat = false; export const enableFloat = true;
export const enableUseHook = true; export const enableUseHook = true;
export const enableUseMemoCacheHook = true; export const enableUseMemoCacheHook = true;
export const enableUseEventHook = true; export const enableUseEventHook = true;
export const enableHostSingletons = false; export const enableHostSingletons = true;
// Logs additional User Timing API marks for use with an experimental profiling tool. // Logs additional User Timing API marks for use with an experimental profiling tool.
export const enableSchedulingProfiler: boolean = export const enableSchedulingProfiler: boolean =
@ -71,6 +71,7 @@ export const warnAboutDefaultPropsOnFunctionComponents = false;
export const enableGetInspectorDataForInstanceInProduction = false; export const enableGetInspectorDataForInstanceInProduction = false;
export const enableCache = true; export const enableCache = true;
export const enableLegacyCache = true;
export const enableCacheElement = true; export const enableCacheElement = true;
export const enableFetchInstrumentation = false; export const enableFetchInstrumentation = false;