Skip to content

Commit

Permalink
Land enableSetImmediate feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Mar 1, 2021
1 parent 553440b commit 7b55a41
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 18 deletions.
3 changes: 0 additions & 3 deletions packages/scheduler/src/SchedulerFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@
export const enableSchedulerDebugging = false;
export const enableIsInputPending = false;
export const enableProfiling = __VARIANT__;

// TODO: enable to fix https://github.com/facebook/react/issues/20756.
export const enableSetImmediate = __VARIANT__;
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ describe('SchedulerDOMSetImmediate', () => {
};
}

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

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

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

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

// @gate enableSchedulerSetImmediate
it('cancels tasks', () => {
const task = scheduleCallback(NormalPriority, () => {
runtime.log('Task');
Expand All @@ -223,7 +218,6 @@ describe('SchedulerDOMSetImmediate', () => {
runtime.assertLog([]);
});

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

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

// @gate enableSchedulerSetImmediate
it('schedule new task after a cancellation', () => {
const handle = scheduleCallback(NormalPriority, () => {
runtime.log('A');
Expand Down
3 changes: 1 addition & 2 deletions packages/scheduler/src/forks/SchedulerDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import {
enableSchedulerDebugging,
enableProfiling,
enableSetImmediate,
} from '../SchedulerFeatureFlags';

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

let schedulePerformWorkUntilDeadline;
if (enableSetImmediate && typeof setImmediate === 'function') {
if (typeof setImmediate === 'function') {
// Node.js and old IE.
// There's a few reasons for why we prefer setImmediate.
//
Expand Down
1 change: 0 additions & 1 deletion packages/scheduler/src/forks/SchedulerFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const {
enableIsInputPending,
enableSchedulerDebugging,
enableProfiling: enableProfilingFeatureFlag,
enableSetImmediate,
} = require('SchedulerFeatureFlags');

export const enableProfiling = __PROFILE__ && enableProfilingFeatureFlag;
4 changes: 0 additions & 4 deletions scripts/jest/TestFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ function getTestFlags() {
// tests, Jest doesn't expose the API correctly. Fix then remove
// this override.
enableCache: __EXPERIMENTAL__,

// This is from SchedulerFeatureFlags. Needed because there's no equivalent
// of ReactFeatureFlags-www.dynamic for it. Remove when enableSetImmediate is gone.
enableSchedulerSetImmediate: schedulerFeatureFlags.enableSetImmediate,
},
{
get(flags, flagName) {
Expand Down

0 comments on commit 7b55a41

Please sign in to comment.