Skip to content

Commit d75c69e

Browse files
authored
Remove unstable_ prefix from Suspense (#13922)
We are using it with lazy and the combination Suspense + lazy seems pretty stable. maxDuration is not but that's only enabled when you're in ConcurrentMode which is still unstable.
1 parent c8ef2fe commit d75c69e

16 files changed

+42
-45
lines changed

fixtures/dom/src/components/fixtures/suspense/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import TestCase from '../../TestCase';
55
const React = window.React;
66
const ReactDOM = window.ReactDOM;
77

8-
const Suspense = React.unstable_Suspense;
8+
const Suspense = React.Suspense;
99

1010
let cache = new Set();
1111

fixtures/unstable-async/suspense/src/components/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {lazy, unstable_Suspense as Suspense, PureComponent} from 'react';
1+
import React, {lazy, Suspense, PureComponent} from 'react';
22
import {unstable_scheduleCallback} from 'scheduler';
33
import {
44
unstable_trace as trace,

fixtures/unstable-async/suspense/src/components/UserPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {unstable_Suspense as Suspense} from 'react';
1+
import React, {Suspense} from 'react';
22
import {createResource} from 'react-cache';
33
import Spinner from './Spinner';
44
import {cache} from '../cache';

packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ describe('ReactDOMServerSuspense', () => {
4848
throw new Promise(() => {});
4949
};
5050
const e = await serverRender(
51-
<React.unstable_Suspense fallback={<div />}>
51+
<React.Suspense fallback={<div />}>
5252
<Suspended />
53-
</React.unstable_Suspense>,
53+
</React.Suspense>,
5454
);
5555

5656
expect(e.tagName).toBe('DIV');

packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.internal.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ describe('ReactDOMSuspensePlaceholder', () => {
2323
beforeEach(() => {
2424
jest.resetModules();
2525
ReactFeatureFlags = require('shared/ReactFeatureFlags');
26-
ReactFeatureFlags.enableSuspense = true;
2726
React = require('react');
2827
ReactDOM = require('react-dom');
2928
ReactCache = require('react-cache');
30-
Suspense = React.unstable_Suspense;
29+
Suspense = React.Suspense;
3130
container = document.createElement('div');
3231

3332
function invalidateCache() {

packages/react-dom/src/__tests__/ReactServerRendering-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ describe('ReactDOMServer', () => {
610610

611611
it('throws for unsupported types on the server', () => {
612612
expect(() => {
613-
ReactDOMServer.renderToString(<React.unstable_Suspense />);
613+
ReactDOMServer.renderToString(<React.Suspense />);
614614
}).toThrow('ReactDOMServer does not yet support Suspense.');
615615

616616
async function fakeImport(result) {

packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,9 @@ describe('ReactDOMServerHydration', () => {
470470
<div>
471471
Hello{' '}
472472
{this.state.isClient && (
473-
<React.unstable_Suspense fallback="loading">
473+
<React.Suspense fallback="loading">
474474
<Lazy />
475-
</React.unstable_Suspense>
475+
</React.Suspense>
476476
)}
477477
</div>
478478
);

packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,9 @@ describe('ReactDebugFiberPerf', () => {
587587

588588
ReactNoop.render(
589589
<Parent>
590-
<React.unstable_Suspense fallback={<Spinner />}>
590+
<React.Suspense fallback={<Spinner />}>
591591
<LazyFoo />
592-
</React.unstable_Suspense>
592+
</React.Suspense>
593593
</Parent>,
594594
);
595595
ReactNoop.flush();
@@ -605,9 +605,9 @@ describe('ReactDebugFiberPerf', () => {
605605

606606
ReactNoop.render(
607607
<Parent>
608-
<React.unstable_Suspense>
608+
<React.Suspense>
609609
<LazyFoo />
610-
</React.unstable_Suspense>
610+
</React.Suspense>
611611
</Parent>,
612612
);
613613
ReactNoop.flush();

packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('ReactLazy', () => {
1111
ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false;
1212
ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false;
1313
React = require('react');
14-
Suspense = React.unstable_Suspense;
14+
Suspense = React.Suspense;
1515
lazy = React.lazy;
1616
ReactTestRenderer = require('react-test-renderer');
1717
});

packages/react-reconciler/src/__tests__/ReactMemo-test.internal.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('memo', () => {
5656
function sharedTests(label, memo) {
5757
describe(`${label}`, () => {
5858
it('bails out on props equality', async () => {
59-
const {unstable_Suspense: Suspense} = React;
59+
const {Suspense} = React;
6060

6161
function Counter({count}) {
6262
return <Text text={count} />;
@@ -93,7 +93,7 @@ describe('memo', () => {
9393
});
9494

9595
it("does not bail out if there's a context change", async () => {
96-
const {unstable_Suspense: Suspense} = React;
96+
const {Suspense} = React;
9797

9898
const CountContext = React.createContext(0);
9999

@@ -142,7 +142,7 @@ describe('memo', () => {
142142
});
143143

144144
it('accepts custom comparison function', async () => {
145-
const {unstable_Suspense: Suspense} = React;
145+
const {Suspense} = React;
146146

147147
function Counter({count}) {
148148
return <Text text={count} />;
@@ -184,7 +184,7 @@ describe('memo', () => {
184184
});
185185

186186
it('supports non-pure class components', async () => {
187-
const {unstable_Suspense: Suspense} = React;
187+
const {Suspense} = React;
188188

189189
class CounterInner extends React.Component {
190190
static defaultProps = {suffix: '!'};

0 commit comments

Comments
 (0)