Skip to content

Commit

Permalink
unstable_Profiler -> Profiler (#15172)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn authored Mar 21, 2019
1 parent 3151813 commit 56035da
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ describe('ReactDOMServerIntegration', () => {

itRenders('a Profiler component and its children', async render => {
const element = await render(
<React.unstable_Profiler id="profiler" onRender={jest.fn()}>
<React.Profiler id="profiler" onRender={jest.fn()}>
<div>Test</div>
</React.unstable_Profiler>,
</React.Profiler>,
);
const parent = element.parentNode;
const div = parent.childNodes[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ describe('ReactDOMServerHydration', () => {
it('should be able to render and hydrate Profiler components', () => {
const callback = jest.fn();
const markup = (
<React.unstable_Profiler id="profiler" onRender={callback}>
<React.Profiler id="profiler" onRender={callback}>
<div>Hi</div>
</React.unstable_Profiler>
</React.Profiler>
);

const element = document.createElement('div');
Expand Down
8 changes: 3 additions & 5 deletions packages/react-is/src/__tests__/ReactIs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,12 @@ describe('ReactIs', () => {

it('should identify profile root', () => {
expect(
ReactIs.typeOf(<React.unstable_Profiler id="foo" onRender={jest.fn()} />),
ReactIs.typeOf(<React.Profiler id="foo" onRender={jest.fn()} />),
).toBe(ReactIs.Profiler);
expect(
ReactIs.isProfiler(
<React.unstable_Profiler id="foo" onRender={jest.fn()} />,
),
ReactIs.isProfiler(<React.Profiler id="foo" onRender={jest.fn()} />),
).toBe(true);
expect(ReactIs.isProfiler({type: ReactIs.unstable_Profiler})).toBe(false);
expect(ReactIs.isProfiler({type: ReactIs.Profiler})).toBe(false);
expect(ReactIs.isProfiler(<React.unstable_ConcurrentMode />)).toBe(false);
expect(ReactIs.isProfiler(<div />)).toBe(false);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ describe('ReactDebugFiberPerf', () => {

it('does not include ConcurrentMode, StrictMode, or Profiler components in measurements', () => {
ReactNoop.render(
<React.unstable_Profiler id="test" onRender={jest.fn()}>
<React.Profiler id="test" onRender={jest.fn()}>
<React.StrictMode>
<Parent>
<React.unstable_ConcurrentMode>
<Child />
</React.unstable_ConcurrentMode>
</Parent>
</React.StrictMode>
</React.unstable_Profiler>,
</React.Profiler>,
);
addComment('Mount');
expect(Scheduler).toFlushWithoutYielding();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('ReactSuspensePlaceholder', () => {
Scheduler = require('scheduler');
ReactCache = require('react-cache');

Profiler = React.unstable_Profiler;
Profiler = React.Profiler;
Suspense = React.Suspense;

TextResource = ReactCache.unstable_createResource(([text, ms = 0]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,20 @@ describe('ReactShallowRenderer', () => {
class SomeComponent extends React.Component {
render() {
return (
<React.unstable_Profiler id="test" onRender={jest.fn()}>
<React.Profiler id="test" onRender={jest.fn()}>
<div>
<span className="child1" />
<span className="child2" />
</div>
</React.unstable_Profiler>
</React.Profiler>
);
}
}

const shallowRenderer = createRenderer();
const result = shallowRenderer.render(<SomeComponent />);

expect(result.type).toBe(React.unstable_Profiler);
expect(result.type).toBe(React.Profiler);
expect(result.props.children).toEqual(
<div>
<span className="child1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ describe('ReactShallowRendererMemo', () => {
class SomeComponent extends React.Component {
render() {
return (
<React.unstable_Profiler id="test" onRender={jest.fn()}>
<React.Profiler id="test" onRender={jest.fn()}>
<div>
<span className="child1" />
<span className="child2" />
</div>
</React.unstable_Profiler>
</React.Profiler>
);
}
},
Expand All @@ -240,7 +240,7 @@ describe('ReactShallowRendererMemo', () => {
const shallowRenderer = createRenderer();
const result = shallowRenderer.render(<SomeComponent />);

expect(result.type).toBe(React.unstable_Profiler);
expect(result.type).toBe(React.Profiler);
expect(result.props.children).toEqual(
<div>
<span className="child1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ describe('ReactTestRendererTraversal', () => {
<View void="void" />
<View void="void" />
</ExampleNull>
<React.unstable_Profiler id="test" onRender={() => {}}>
<React.Profiler id="test" onRender={() => {}}>
<ExampleForwardRef qux="qux" />
</React.unstable_Profiler>
</React.Profiler>
<React.Fragment>
<React.Fragment>
<Context.Provider value={null}>
Expand Down
4 changes: 1 addition & 3 deletions packages/react/src/React.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const React = {
useState,

Fragment: REACT_FRAGMENT_TYPE,
Profiler: REACT_PROFILER_TYPE,
StrictMode: REACT_STRICT_MODE_TYPE,
Suspense: REACT_SUSPENSE_TYPE,

Expand All @@ -88,7 +89,6 @@ const React = {
version: ReactVersion,

unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
unstable_Profiler: REACT_PROFILER_TYPE,

__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals,
};
Expand All @@ -100,9 +100,7 @@ const React = {

if (enableStableConcurrentModeAPIs) {
React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
React.Profiler = REACT_PROFILER_TYPE;
React.unstable_ConcurrentMode = undefined;
React.unstable_Profiler = undefined;
}

export default React;
Loading

0 comments on commit 56035da

Please sign in to comment.