Skip to content

Commit d857f9e

Browse files
authored
Land enableSetImmediate feature flag (#20906)
1 parent 553440b commit d857f9e

File tree

5 files changed

+1
-19
lines changed

5 files changed

+1
-19
lines changed

packages/scheduler/src/SchedulerFeatureFlags.js

-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@
99
export const enableSchedulerDebugging = false;
1010
export const enableIsInputPending = false;
1111
export const enableProfiling = __VARIANT__;
12-
13-
// TODO: enable to fix https://github.com/facebook/react/issues/20756.
14-
export const enableSetImmediate = __VARIANT__;

packages/scheduler/src/__tests__/SchedulerDOMSetImmediate-test.js

-8
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ describe('SchedulerDOMSetImmediate', () => {
143143
};
144144
}
145145

146-
// @gate enableSchedulerSetImmediate
147146
it('task that finishes before deadline', () => {
148147
scheduleCallback(NormalPriority, () => {
149148
runtime.log('Task');
@@ -153,7 +152,6 @@ describe('SchedulerDOMSetImmediate', () => {
153152
runtime.assertLog(['setImmediate Callback', 'Task']);
154153
});
155154

156-
// @gate enableSchedulerSetImmediate
157155
it('task with continuation', () => {
158156
scheduleCallback(NormalPriority, () => {
159157
runtime.log('Task');
@@ -179,7 +177,6 @@ describe('SchedulerDOMSetImmediate', () => {
179177
runtime.assertLog(['setImmediate Callback', 'Continuation']);
180178
});
181179

182-
// @gate enableSchedulerSetImmediate
183180
it('multiple tasks', () => {
184181
scheduleCallback(NormalPriority, () => {
185182
runtime.log('A');
@@ -192,7 +189,6 @@ describe('SchedulerDOMSetImmediate', () => {
192189
runtime.assertLog(['setImmediate Callback', 'A', 'B']);
193190
});
194191

195-
// @gate enableSchedulerSetImmediate
196192
it('multiple tasks with a yield in between', () => {
197193
scheduleCallback(NormalPriority, () => {
198194
runtime.log('A');
@@ -213,7 +209,6 @@ describe('SchedulerDOMSetImmediate', () => {
213209
runtime.assertLog(['setImmediate Callback', 'B']);
214210
});
215211

216-
// @gate enableSchedulerSetImmediate
217212
it('cancels tasks', () => {
218213
const task = scheduleCallback(NormalPriority, () => {
219214
runtime.log('Task');
@@ -223,7 +218,6 @@ describe('SchedulerDOMSetImmediate', () => {
223218
runtime.assertLog([]);
224219
});
225220

226-
// @gate enableSchedulerSetImmediate
227221
it('throws when a task errors then continues in a new event', () => {
228222
scheduleCallback(NormalPriority, () => {
229223
runtime.log('Oops!');
@@ -241,7 +235,6 @@ describe('SchedulerDOMSetImmediate', () => {
241235
runtime.assertLog(['setImmediate Callback', 'Yay']);
242236
});
243237

244-
// @gate enableSchedulerSetImmediate
245238
it('schedule new task after queue has emptied', () => {
246239
scheduleCallback(NormalPriority, () => {
247240
runtime.log('A');
@@ -259,7 +252,6 @@ describe('SchedulerDOMSetImmediate', () => {
259252
runtime.assertLog(['setImmediate Callback', 'B']);
260253
});
261254

262-
// @gate enableSchedulerSetImmediate
263255
it('schedule new task after a cancellation', () => {
264256
const handle = scheduleCallback(NormalPriority, () => {
265257
runtime.log('A');

packages/scheduler/src/forks/SchedulerDOM.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import {
1212
enableSchedulerDebugging,
1313
enableProfiling,
14-
enableSetImmediate,
1514
} from '../SchedulerFeatureFlags';
1615

1716
import {push, pop, peek} from '../SchedulerMinHeap';
@@ -553,7 +552,7 @@ const performWorkUntilDeadline = () => {
553552
};
554553

555554
let schedulePerformWorkUntilDeadline;
556-
if (enableSetImmediate && typeof setImmediate === 'function') {
555+
if (typeof setImmediate === 'function') {
557556
// Node.js and old IE.
558557
// There's a few reasons for why we prefer setImmediate.
559558
//

packages/scheduler/src/forks/SchedulerFeatureFlags.www.js

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export const {
1010
enableIsInputPending,
1111
enableSchedulerDebugging,
1212
enableProfiling: enableProfilingFeatureFlag,
13-
enableSetImmediate,
1413
} = require('SchedulerFeatureFlags');
1514

1615
export const enableProfiling = __PROFILE__ && enableProfilingFeatureFlag;

scripts/jest/TestFlags.js

-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ function getTestFlags() {
5555
// These are required on demand because some of our tests mutate them. We try
5656
// not to but there are exceptions.
5757
const featureFlags = require('shared/ReactFeatureFlags');
58-
const schedulerFeatureFlags = require('scheduler/src/SchedulerFeatureFlags');
5958

6059
// TODO: This is a heuristic to detect the release channel by checking a flag
6160
// that is known to only be enabled in www. What we should do instead is set
@@ -90,10 +89,6 @@ function getTestFlags() {
9089
// tests, Jest doesn't expose the API correctly. Fix then remove
9190
// this override.
9291
enableCache: __EXPERIMENTAL__,
93-
94-
// This is from SchedulerFeatureFlags. Needed because there's no equivalent
95-
// of ReactFeatureFlags-www.dynamic for it. Remove when enableSetImmediate is gone.
96-
enableSchedulerSetImmediate: schedulerFeatureFlags.enableSetImmediate,
9792
},
9893
{
9994
get(flags, flagName) {

0 commit comments

Comments
 (0)