Skip to content

Commit

Permalink
rename SuspenseList export to unstable_SuspenseList (#27061)
Browse files Browse the repository at this point in the history
## Summary

as we began [discussing
yesterday](#27056 (comment)),
`SuspenseList` is not actually stable yet, and should likely be exported
with the `unstable_` prefix.

the conversation yesterday began discussing this in the context of the
fb-specific packages, but changing it there without updating everywhere
else leads to test failures, so here the change is made across packages.

## How did you test this change?

```
yarn flow dom-browser
yarn test
```
  • Loading branch information
noahlemen authored Jul 6, 2023
1 parent a19bbeb commit eb2c2f7
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion fixtures/stacks/Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Example() {
DisplayName,
null,
x(
React.SuspenseList,
React.unstable_SuspenseList,
null,
x(
NativeClass,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-shared/src/__tests__/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,13 @@ describe('Store', () => {
};
const Wrapper = ({shouldSuspense}) => (
<React.Fragment>
<React.SuspenseList revealOrder="forwards" tail="collapsed">
<React.unstable_SuspenseList revealOrder="forwards" tail="collapsed">
<Component key="A" />
<React.Suspense fallback={<Loading />}>
{shouldSuspense ? <SuspendingComponent /> : <Component key="B" />}
</React.Suspense>
<Component key="C" />
</React.SuspenseList>
</React.unstable_SuspenseList>
</React.Fragment>
);

Expand Down
7 changes: 6 additions & 1 deletion packages/react-devtools-shell/src/app/SuspenseTree/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
*/

import * as React from 'react';
import {Fragment, Suspense, SuspenseList, useState} from 'react';
import {
Fragment,
Suspense,
unstable_SuspenseList as SuspenseList,
useState,
} from 'react';

function SuspenseTree(): React.Node {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('ReactDOMFizzServer', () => {
Suspense = React.Suspense;
use = React.use;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}

PropTypes = require('prop-types');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('ReactDOMServerPartialHydration', () => {
Offscreen = React.unstable_Offscreen;
useSyncExternalStore = React.useSyncExternalStore;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}

const InternalTestUtils = require('internal-test-utils');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function initModules() {
ReactTestUtils = require('react-dom/test-utils');
act = require('internal-test-utils').act;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}

// Make them available to the helpers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ beforeEach(() => {

Suspense = React.Suspense;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}

getCacheForType = React.unstable_getCacheForType;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-is/src/__tests__/ReactIs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('ReactIs', () => {
ReactIs = require('react-is');

if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('ReactLazyContextPropagation', () => {
useContext = React.useContext;
Suspense = React.Suspense;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}

const InternalTestUtils = require('internal-test-utils');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('ReactHooksWithNoopRenderer', () => {
ContinuousEventPriority =
require('react-reconciler/constants').ContinuousEventPriority;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}

const InternalTestUtils = require('internal-test-utils');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('ReactSuspenseList', () => {
Profiler = React.Profiler;
Suspense = React.Suspense;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}

const InternalTestUtils = require('internal-test-utils');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('ReactSuspenseyCommitPhase', () => {
Scheduler = require('scheduler');
Suspense = React.Suspense;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.SuspenseList;
SuspenseList = React.unstable_SuspenseList;
}
Offscreen = React.unstable_Offscreen;
useMemo = React.useMemo;
Expand Down
3 changes: 1 addition & 2 deletions packages/react/index.classic.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export {
PureComponent,
StrictMode,
Suspense,
SuspenseList,
SuspenseList as unstable_SuspenseList, // TODO: Remove once call sights updated to SuspenseList
cloneElement,
createContext,
createElement,
Expand All @@ -38,6 +36,7 @@ export {
unstable_LegacyHidden,
unstable_Offscreen,
unstable_Scope,
unstable_SuspenseList,
unstable_getCacheSignal,
unstable_getCacheForType,
unstable_useCacheRefresh,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/index.experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export {
PureComponent,
StrictMode,
Suspense,
SuspenseList,
cloneElement,
createContext,
createElement,
Expand All @@ -36,6 +35,7 @@ export {
unstable_Offscreen,
unstable_getCacheSignal,
unstable_getCacheForType,
unstable_SuspenseList,
unstable_useCacheRefresh,
unstable_useMemoCache,
useId,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export {
PureComponent,
StrictMode,
Suspense,
SuspenseList,
cloneElement,
createContext,
createElement,
Expand All @@ -59,6 +58,7 @@ export {
unstable_LegacyHidden,
unstable_Offscreen,
unstable_Scope,
unstable_SuspenseList,
unstable_TracingMarker,
unstable_getCacheSignal,
unstable_getCacheForType,
Expand Down
3 changes: 1 addition & 2 deletions packages/react/index.modern.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export {
PureComponent,
StrictMode,
Suspense,
SuspenseList,
SuspenseList as unstable_SuspenseList, // TODO: Remove once call sights updated to SuspenseList
cloneElement,
createContext,
createElement,
Expand All @@ -36,6 +34,7 @@ export {
unstable_LegacyHidden,
unstable_Offscreen,
unstable_Scope,
unstable_SuspenseList,
unstable_getCacheSignal,
unstable_getCacheForType,
unstable_useCacheRefresh,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/React.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export {
useTransition,
startTransition,
useDeferredValue,
REACT_SUSPENSE_LIST_TYPE as SuspenseList,
REACT_SUSPENSE_LIST_TYPE as unstable_SuspenseList,
REACT_LEGACY_HIDDEN_TYPE as unstable_LegacyHidden,
REACT_OFFSCREEN_TYPE as unstable_Offscreen,
getCacheSignal as unstable_getCacheSignal,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/ReactSharedSubset.experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export {
Profiler,
StrictMode,
Suspense,
SuspenseList,
cloneElement,
createElement,
createRef,
Expand All @@ -30,6 +29,7 @@ export {
cache,
startTransition,
unstable_DebugTracingMode,
unstable_SuspenseList,
unstable_getCacheSignal,
unstable_getCacheForType,
useId,
Expand Down

0 comments on commit eb2c2f7

Please sign in to comment.