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

Land enableSetImmediate feature flag #20906

Merged
merged 1 commit into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
5 changes: 0 additions & 5 deletions scripts/jest/TestFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ function getTestFlags() {
// These are required on demand because some of our tests mutate them. We try
// not to but there are exceptions.
const featureFlags = require('shared/ReactFeatureFlags');
const schedulerFeatureFlags = require('scheduler/src/SchedulerFeatureFlags');

// TODO: This is a heuristic to detect the release channel by checking a flag
// that is known to only be enabled in www. What we should do instead is set
Expand Down Expand Up @@ -90,10 +89,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