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

Mark Profiler API as stable #15172

Merged
merged 1 commit into from Mar 21, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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];
@@ -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');
@@ -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);
});
@@ -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();
@@ -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]) => {
@@ -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" />
@@ -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>
);
}
},
@@ -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" />
@@ -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}>
@@ -77,6 +77,7 @@ const React = {
useState,

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

@@ -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,
};
@@ -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;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.