From 0dc0ddc1ef5f90fe48b58f1a1ba753757961fc74 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Wed, 26 Sep 2018 17:13:02 +0100 Subject: [PATCH] Rename AsyncMode -> ConcurrentMode (#13732) * Rename AsyncMode -> ConcurrentMode --- .../unstable-async/time-slicing/src/index.js | 4 +- .../ReactDOMFiberAsync-test.internal.js | 32 +++++++------- .../src/__tests__/ReactDOMRoot-test.js | 16 +++---- .../ReactDOMServerIntegrationModes-test.js | 44 +++++++++---------- packages/react-dom/src/client/ReactDOM.js | 12 +++-- .../SimpleEventPlugin-test.internal.js | 4 +- .../src/server/ReactPartialRenderer.js | 4 +- packages/react-is/README.md | 6 +-- packages/react-is/src/ReactIs.js | 28 ++++++++++-- .../react-is/src/__tests__/ReactIs-test.js | 28 +++++++----- .../src/createReactNoop.js | 18 +++++--- packages/react-reconciler/src/ReactFiber.js | 19 +++++--- .../src/ReactFiberBeginWork.js | 4 +- .../src/ReactFiberReconciler.js | 4 +- .../react-reconciler/src/ReactFiberRoot.js | 4 +- .../src/ReactFiberScheduler.js | 4 +- .../src/ReactFiberUnwindWork.js | 6 +-- .../react-reconciler/src/ReactTypeOfMode.js | 2 +- .../ReactIncrementalPerf-test.internal.js | 6 +-- .../__tests__/ReactSuspense-test.internal.js | 24 +++++----- ...ReactIncrementalPerf-test.internal.js.snap | 2 +- .../src/ReactTestRenderer.js | 10 ++--- .../__tests__/ReactTestRendererAsync-test.js | 14 +++--- packages/react/src/React.js | 4 +- .../__tests__/ReactProfiler-test.internal.js | 36 +++++++-------- .../ReactStrictMode-test.internal.js | 32 +++++++------- packages/shared/ReactSymbols.js | 4 +- packages/shared/getComponentName.js | 6 +-- packages/shared/isValidElementType.js | 4 +- 29 files changed, 211 insertions(+), 170 deletions(-) diff --git a/fixtures/unstable-async/time-slicing/src/index.js b/fixtures/unstable-async/time-slicing/src/index.js index 0b1436e04eceb..8b84d723acf4b 100644 --- a/fixtures/unstable-async/time-slicing/src/index.js +++ b/fixtures/unstable-async/time-slicing/src/index.js @@ -147,8 +147,8 @@ class App extends PureComponent { const container = document.getElementById('root'); render( - + - , + , container ); diff --git a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.internal.js index 5768aa5f5d45d..84cfb049f0a01 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.internal.js @@ -14,7 +14,7 @@ let ReactFeatureFlags = require('shared/ReactFeatureFlags'); let ReactDOM; -const AsyncMode = React.unstable_AsyncMode; +const ConcurrentMode = React.unstable_ConcurrentMode; const setUntrackedInputValue = Object.getOwnPropertyDescriptor( HTMLInputElement.prototype, @@ -108,9 +108,9 @@ describe('ReactDOMFiberAsync', () => { } } ReactDOM.render( - + - , + , container, ); expect(asyncValueRef.current.textContent).toBe(''); @@ -137,17 +137,17 @@ describe('ReactDOMFiberAsync', () => { it('renders synchronously', () => { ReactDOM.render( - +
Hi
-
, + , container, ); expect(container.textContent).toEqual('Hi'); ReactDOM.render( - +
Bye
-
, + , container, ); expect(container.textContent).toEqual('Bye'); @@ -197,7 +197,7 @@ describe('ReactDOMFiberAsync', () => { expect(container.textContent).toEqual('1'); }); - it('AsyncMode creates an async subtree', () => { + it('ConcurrentMode creates an async subtree', () => { let instance; class Component extends React.Component { state = {step: 0}; @@ -208,9 +208,9 @@ describe('ReactDOMFiberAsync', () => { } ReactDOM.render( - + - , + , container, ); jest.runAllTimers(); @@ -233,9 +233,9 @@ describe('ReactDOMFiberAsync', () => { ReactDOM.render(
- + - +
, container, ); @@ -364,9 +364,9 @@ describe('ReactDOMFiberAsync', () => { } ReactDOM.render( - + - , + , container, ); jest.runAllTimers(); @@ -409,9 +409,9 @@ describe('ReactDOMFiberAsync', () => { } } ReactDOM.render( - + - , + , container, ); expect(container.textContent).toEqual('0'); diff --git a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js index 9f7801d2246cb..4157e64b46cad 100644 --- a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js @@ -12,7 +12,7 @@ let React = require('react'); let ReactDOM = require('react-dom'); let ReactDOMServer = require('react-dom/server'); -let AsyncMode = React.unstable_AsyncMode; +let ConcurrentMode = React.unstable_ConcurrentMode; describe('ReactDOMRoot', () => { let container; @@ -63,7 +63,7 @@ describe('ReactDOMRoot', () => { React = require('react'); ReactDOM = require('react-dom'); ReactDOMServer = require('react-dom/server'); - AsyncMode = React.unstable_AsyncMode; + ConcurrentMode = React.unstable_ConcurrentMode; }); it('renders children', () => { @@ -85,7 +85,7 @@ describe('ReactDOMRoot', () => { it('`root.render` returns a thenable work object', () => { const root = ReactDOM.unstable_createRoot(container); - const work = root.render(Hi); + const work = root.render(Hi); let ops = []; work.then(() => { ops.push('inside callback: ' + container.textContent); @@ -103,7 +103,7 @@ describe('ReactDOMRoot', () => { it('resolves `work.then` callback synchronously if the work already committed', () => { const root = ReactDOM.unstable_createRoot(container); - const work = root.render(Hi); + const work = root.render(Hi); jest.runAllTimers(); let ops = []; work.then(() => { @@ -196,9 +196,9 @@ describe('ReactDOMRoot', () => { const root = ReactDOM.unstable_createRoot(container); const batch = root.createBatch(); batch.render( - + - , + , ); jest.runAllTimers(); @@ -246,7 +246,7 @@ describe('ReactDOMRoot', () => { it('can wait for a batch to finish', () => { const root = ReactDOM.unstable_createRoot(container); const batch = root.createBatch(); - batch.render(Foo); + batch.render(Foo); jest.runAllTimers(); @@ -286,7 +286,7 @@ describe('ReactDOMRoot', () => { it('can commit an empty batch', () => { const root = ReactDOM.unstable_createRoot(container); - root.render(1); + root.render(1); advanceCurrentTime(2000); // This batch has a later expiration time than the earlier update. diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js index ce37aa61616fb..3a4abc6abb249 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js @@ -104,36 +104,36 @@ describe('ReactDOMServerIntegration', () => { }); }); - describe('React.unstable_AsyncMode', () => { - itRenders('an async mode with one child', async render => { + describe('React.unstable_ConcurrentMode', () => { + itRenders('an concurrent mode with one child', async render => { let e = await render( - +
text1
-
, + , ); let parent = e.parentNode; expect(parent.childNodes[0].tagName).toBe('DIV'); }); - itRenders('an async mode with several children', async render => { + itRenders('an concurrent mode with several children', async render => { let Header = props => { return

header

; }; let Footer = props => { return ( - +

footer

about

-
+ ); }; let e = await render( - +
text1
text2