Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unstable_ prefix from Suspense #13922

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion fixtures/dom/src/components/fixtures/suspense/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TestCase from '../../TestCase';
const React = window.React;
const ReactDOM = window.ReactDOM;

const Suspense = React.unstable_Suspense;
const Suspense = React.Suspense;

let cache = new Set();

Expand Down
2 changes: 1 addition & 1 deletion fixtures/unstable-async/suspense/src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {lazy, unstable_Suspense as Suspense, PureComponent} from 'react';
import React, {lazy, Suspense, PureComponent} from 'react';
import {unstable_scheduleCallback} from 'scheduler';
import {
unstable_trace as trace,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {unstable_Suspense as Suspense} from 'react';
import React, {Suspense} from 'react';
import {createResource} from 'react-cache';
import Spinner from './Spinner';
import {cache} from '../cache';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ describe('ReactDOMServerSuspense', () => {
throw new Promise(() => {});
};
const e = await serverRender(
<React.unstable_Suspense fallback={<div />}>
<React.Suspense fallback={<div />}>
<Suspended />
</React.unstable_Suspense>,
</React.Suspense>,
);

expect(e.tagName).toBe('DIV');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ describe('ReactDOMSuspensePlaceholder', () => {
beforeEach(() => {
jest.resetModules();
ReactFeatureFlags = require('shared/ReactFeatureFlags');
ReactFeatureFlags.enableSuspense = true;
React = require('react');
ReactDOM = require('react-dom');
ReactCache = require('react-cache');
Suspense = React.unstable_Suspense;
Suspense = React.Suspense;
container = document.createElement('div');

function invalidateCache() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ describe('ReactDOMServer', () => {

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

async function fakeImport(result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,9 @@ describe('ReactDOMServerHydration', () => {
<div>
Hello{' '}
{this.state.isClient && (
<React.unstable_Suspense fallback="loading">
<React.Suspense fallback="loading">
<Lazy />
</React.unstable_Suspense>
</React.Suspense>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,9 @@ describe('ReactDebugFiberPerf', () => {

ReactNoop.render(
<Parent>
<React.unstable_Suspense fallback={<Spinner />}>
<React.Suspense fallback={<Spinner />}>
<LazyFoo />
</React.unstable_Suspense>
</React.Suspense>
</Parent>,
);
ReactNoop.flush();
Expand All @@ -605,9 +605,9 @@ describe('ReactDebugFiberPerf', () => {

ReactNoop.render(
<Parent>
<React.unstable_Suspense>
<React.Suspense>
<LazyFoo />
</React.unstable_Suspense>
</React.Suspense>
</Parent>,
);
ReactNoop.flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('ReactLazy', () => {
ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false;
ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false;
React = require('react');
Suspense = React.unstable_Suspense;
Suspense = React.Suspense;
lazy = React.lazy;
ReactTestRenderer = require('react-test-renderer');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('memo', () => {
function sharedTests(label, memo) {
describe(`${label}`, () => {
it('bails out on props equality', async () => {
const {unstable_Suspense: Suspense} = React;
const {Suspense} = React;

function Counter({count}) {
return <Text text={count} />;
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('memo', () => {
});

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

const CountContext = React.createContext(0);

Expand Down Expand Up @@ -142,7 +142,7 @@ describe('memo', () => {
});

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

function Counter({count}) {
return <Text text={count} />;
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('memo', () => {
});

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

class CounterInner extends React.Component {
static defaultProps = {suffix: '!'};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('ReactSuspense', () => {
// JestReact = require('jest-react');
ReactCache = require('react-cache');

Suspense = React.unstable_Suspense;
Suspense = React.Suspense;

function invalidateCache() {
cache = ReactCache.createCache(invalidateCache);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function runPlaceholderTests(suiteLabel, loadReactNoop) {
// JestReact = require('jest-react');
ReactCache = require('react-cache');

Suspense = React.unstable_Suspense;
Suspense = React.Suspense;

function invalidateCache() {
cache = ReactCache.createCache(invalidateCache);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
Fragment = React.Fragment;
ReactNoop = require('react-noop-renderer');
ReactCache = require('react-cache');
Suspense = React.unstable_Suspense;
Suspense = React.Suspense;
StrictMode = React.StrictMode;
ConcurrentMode = React.unstable_ConcurrentMode;

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 @@ -55,7 +55,7 @@ const React = {
Fragment: REACT_FRAGMENT_TYPE,
StrictMode: REACT_STRICT_MODE_TYPE,
unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
unstable_Suspense: REACT_SUSPENSE_TYPE,
Suspense: REACT_SUSPENSE_TYPE,
unstable_Profiler: REACT_PROFILER_TYPE,

createElement: __DEV__ ? createElementWithValidation : createElement,
Expand Down
36 changes: 18 additions & 18 deletions packages/react/src/__tests__/ReactProfiler-test.internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2228,9 +2228,9 @@ describe('Profiler', () => {
SchedulerTracing.unstable_trace(interaction.name, mockNow(), () => {
ReactNoop.render(
<React.unstable_Profiler id="test-profiler" onRender={onRender}>
<React.unstable_Suspense fallback={<Text text="Loading..." />}>
<React.Suspense fallback={<Text text="Loading..." />}>
<AsyncText text="Async" ms={20000} />
</React.unstable_Suspense>
</React.Suspense>
<Text text="Sync" />
<Monkey ref={monkey} />
</React.unstable_Profiler>,
Expand Down Expand Up @@ -2316,11 +2316,11 @@ describe('Profiler', () => {
() => {
ReactTestRenderer.create(
<React.unstable_Profiler id="app" onRender={onRender}>
<React.unstable_Suspense
<React.Suspense
maxDuration={1000}
fallback={<Text text="loading" />}>
<AsyncText text="loaded" ms={2000} />
</React.unstable_Suspense>
</React.Suspense>
</React.unstable_Profiler>,
);
},
Expand Down Expand Up @@ -2370,11 +2370,11 @@ describe('Profiler', () => {
() => {
ReactTestRenderer.create(
<React.unstable_Profiler id="app" onRender={onRender}>
<React.unstable_Suspense
<React.Suspense
maxDuration={1000}
fallback={<Text text="loading" />}>
<AsyncComponentWithCascadingWork text="loaded" ms={2000} />
</React.unstable_Suspense>
</React.Suspense>
</React.unstable_Profiler>,
);
},
Expand Down Expand Up @@ -2410,11 +2410,11 @@ describe('Profiler', () => {
() => {
renderer = ReactTestRenderer.create(
<React.unstable_Profiler id="app" onRender={onRender}>
<React.unstable_Suspense
<React.Suspense
maxDuration={1000}
fallback={<Text text="loading" />}>
<AsyncText text="loaded" ms={2000} />
</React.unstable_Suspense>
</React.Suspense>
</React.unstable_Profiler>,
{
unstable_isConcurrent: true,
Expand Down Expand Up @@ -2458,11 +2458,11 @@ describe('Profiler', () => {
() => {
renderer = ReactTestRenderer.create(
<React.unstable_Profiler id="app" onRender={onRender}>
<React.unstable_Suspense
<React.Suspense
maxDuration={2000}
fallback={<Text text="loading" />}>
<AsyncText text="loaded" ms={1000} />
</React.unstable_Suspense>
</React.Suspense>
</React.unstable_Profiler>,
{unstable_isConcurrent: true},
);
Expand Down Expand Up @@ -2497,11 +2497,11 @@ describe('Profiler', () => {
() => {
renderer = ReactTestRenderer.create(
<React.unstable_Profiler id="app" onRender={onRender}>
<React.unstable_Suspense
<React.Suspense
maxDuration={2000}
fallback={<Text text="loading" />}>
<AsyncText text="loaded" ms={1000} />
</React.unstable_Suspense>
</React.Suspense>
<Text text="initial" />
</React.unstable_Profiler>,
);
Expand Down Expand Up @@ -2531,11 +2531,11 @@ describe('Profiler', () => {
() => {
renderer.update(
<React.unstable_Profiler id="app" onRender={onRender}>
<React.unstable_Suspense
<React.Suspense
maxDuration={2000}
fallback={<Text text="loading" />}>
<AsyncText text="loaded" ms={1000} />
</React.unstable_Suspense>
</React.Suspense>
<Text text="updated" />
</React.unstable_Profiler>,
);
Expand Down Expand Up @@ -2593,11 +2593,11 @@ describe('Profiler', () => {
() => {
renderer = ReactTestRenderer.create(
<React.unstable_Profiler id="app" onRender={onRender}>
<React.unstable_Suspense
<React.Suspense
maxDuration={2000}
fallback={<Text text="loading" />}>
<AsyncText text="loaded" ms={1000} />
</React.unstable_Suspense>
</React.Suspense>
<Text text="initial" />
</React.unstable_Profiler>,
{unstable_isConcurrent: true},
Expand Down Expand Up @@ -2631,11 +2631,11 @@ describe('Profiler', () => {
() => {
renderer.update(
<React.unstable_Profiler id="app" onRender={onRender}>
<React.unstable_Suspense
<React.Suspense
maxDuration={2000}
fallback={<Text text="loading" />}>
<AsyncText text="loaded" ms={1000} />
</React.unstable_Suspense>
</React.Suspense>
<Text text="updated" />
</React.unstable_Profiler>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ describe('ProfilerDOM', () => {
const root = ReactDOM.unstable_createRoot(element);
batch = root.createBatch();
batch.render(
<React.unstable_Suspense
maxDuration={100}
fallback={<Text text="Loading..." />}>
<React.Suspense maxDuration={100} fallback={<Text text="Loading..." />}>
<AsyncText text="Text" ms={200} />
</React.unstable_Suspense>,
</React.Suspense>,
);
batch.then(
SchedulerTracing.unstable_wrap(() => {
Expand Down