Remove unstable scheduler/tracing API (#20037)

This commit is contained in:
Brian Vaughn
2021-04-26 19:16:18 -04:00
committed by GitHub
parent 7212383945
commit fc33f12bde
94 changed files with 2710 additions and 11153 deletions
@@ -16,7 +16,6 @@ describe('ProfilingCache', () => {
let React;
let ReactDOM;
let Scheduler;
let SchedulerTracing;
let TestRenderer: ReactTestRenderer;
let bridge: FrontendBridge;
let store: Store;
@@ -35,7 +34,6 @@ describe('ProfilingCache', () => {
React = require('react');
ReactDOM = require('react-dom');
Scheduler = require('scheduler');
SchedulerTracing = require('scheduler/tracing');
TestRenderer = utils.requireTestRenderer();
});
@@ -622,79 +620,6 @@ describe('ProfilingCache', () => {
}
});
it('should report every traced interaction', () => {
const Parent = ({count}) => {
Scheduler.unstable_advanceTime(10);
const children = new Array(count)
.fill(true)
.map((_, index) => <Child key={index} duration={index} />);
return (
<React.Fragment>
{children}
<MemoizedChild duration={1} />
</React.Fragment>
);
};
const Child = ({duration}) => {
Scheduler.unstable_advanceTime(duration);
return null;
};
const MemoizedChild = React.memo(Child);
const container = document.createElement('div');
utils.act(() => store.profilerStore.startProfiling());
utils.act(() =>
SchedulerTracing.unstable_trace(
'mount: one child',
Scheduler.unstable_now(),
() => ReactDOM.render(<Parent count={1} />, container),
),
);
utils.act(() =>
SchedulerTracing.unstable_trace(
'update: two children',
Scheduler.unstable_now(),
() => ReactDOM.render(<Parent count={2} />, container),
),
);
utils.act(() => store.profilerStore.stopProfiling());
let interactions = null;
function Validator({previousInteractions, rootID}) {
interactions = store.profilerStore.profilingCache.getInteractionsChartData(
{
rootID,
},
).interactions;
if (previousInteractions != null) {
expect(interactions).toEqual(previousInteractions);
} else {
expect(interactions).toMatchSnapshot('Interactions');
}
return null;
}
const rootID = store.roots[0];
utils.act(() =>
TestRenderer.create(
<Validator previousInteractions={null} rootID={rootID} />,
),
);
expect(interactions).not.toBeNull();
utils.exportImportHelper(bridge, store);
utils.act(() =>
TestRenderer.create(
<Validator previousInteractions={interactions} rootID={rootID} />,
),
);
});
it('should handle unexpectedly shallow suspense trees', () => {
const container = document.createElement('div');