Skip to content

Commit c05608a

Browse files
committed
Replace old Fiber Scheduler with new one
The new Fiber Scheduler has been running in Facebook for several days without issues. Let's switch to it.
1 parent de75903 commit c05608a

34 files changed

+2917
-7085
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
"test": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source.js",
103103
"test-persistent": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-persistent.js",
104104
"test-fire": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-fire.js",
105-
"test-new-scheduler": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-new-scheduler.js",
106105
"test-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source.js",
107106
"test-fire-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source-fire.js",
108107
"test-prod-build": "yarn test-build-prod",

packages/react-dom/src/__tests__/ReactDOMHooks-test.internal.js renamed to packages/react-dom/src/__tests__/ReactDOMHooks-test.js

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
'use strict';
1111

12-
let ReactFeatureFlags;
13-
let enableNewScheduler;
1412
let React;
1513
let ReactDOM;
1614
let Scheduler;
@@ -21,8 +19,6 @@ describe('ReactDOMHooks', () => {
2119
beforeEach(() => {
2220
jest.resetModules();
2321

24-
ReactFeatureFlags = require('shared/ReactFeatureFlags');
25-
enableNewScheduler = ReactFeatureFlags.enableNewScheduler;
2622
React = require('react');
2723
ReactDOM = require('react-dom');
2824
Scheduler = require('scheduler');
@@ -101,30 +97,15 @@ describe('ReactDOMHooks', () => {
10197
}
10298

10399
ReactDOM.render(<Foo />, container);
104-
105-
if (enableNewScheduler) {
106-
// The old behavior was accidental; in the new scheduler, flushing passive
107-
// effects also flushes synchronous work, even inside batchedUpdates.
108-
ReactDOM.unstable_batchedUpdates(() => {
109-
_set(0); // Forces the effect to be flushed
110-
expect(otherContainer.textContent).toBe('A');
111-
ReactDOM.render(<B />, otherContainer);
112-
expect(otherContainer.textContent).toBe('A');
113-
});
114-
expect(otherContainer.textContent).toBe('B');
115-
expect(calledA).toBe(true);
116-
expect(calledB).toBe(true);
117-
} else {
118-
ReactDOM.unstable_batchedUpdates(() => {
119-
_set(0); // Forces the effect to be flushed
120-
expect(otherContainer.textContent).toBe('');
121-
ReactDOM.render(<B />, otherContainer);
122-
expect(otherContainer.textContent).toBe('');
123-
});
124-
expect(otherContainer.textContent).toBe('B');
125-
expect(calledA).toBe(false); // It was in a batch
126-
expect(calledB).toBe(true);
127-
}
100+
ReactDOM.unstable_batchedUpdates(() => {
101+
_set(0); // Forces the effect to be flushed
102+
expect(otherContainer.textContent).toBe('A');
103+
ReactDOM.render(<B />, otherContainer);
104+
expect(otherContainer.textContent).toBe('A');
105+
});
106+
expect(otherContainer.textContent).toBe('B');
107+
expect(calledA).toBe(true);
108+
expect(calledB).toBe(true);
128109
});
129110

130111
it('should not bail out when an update is scheduled from within an event handler', () => {

packages/react-dom/unstable-new-scheduler.fb.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/react-dom/unstable-new-scheduler.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/react-reconciler/src/ReactFiberPendingPriority.js

Lines changed: 0 additions & 265 deletions
This file was deleted.

0 commit comments

Comments
 (0)