mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Add feature flag to disable scheduler timeout in work loop (#19771)
This commit is contained in:
parent
eabd18c73f
commit
36df483af4
|
|
@ -30,6 +30,7 @@ import {
|
||||||
enableSchedulingProfiler,
|
enableSchedulingProfiler,
|
||||||
enableScopeAPI,
|
enableScopeAPI,
|
||||||
skipUnmountedBoundaries,
|
skipUnmountedBoundaries,
|
||||||
|
disableSchedulerTimeoutInWorkLoop,
|
||||||
} from 'shared/ReactFeatureFlags';
|
} from 'shared/ReactFeatureFlags';
|
||||||
import ReactSharedInternals from 'shared/ReactSharedInternals';
|
import ReactSharedInternals from 'shared/ReactSharedInternals';
|
||||||
import invariant from 'shared/invariant';
|
import invariant from 'shared/invariant';
|
||||||
|
|
@ -750,7 +751,7 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
|
||||||
|
|
||||||
// This is the entry point for every concurrent task, i.e. anything that
|
// This is the entry point for every concurrent task, i.e. anything that
|
||||||
// goes through Scheduler.
|
// goes through Scheduler.
|
||||||
function performConcurrentWorkOnRoot(root) {
|
function performConcurrentWorkOnRoot(root, didTimeout) {
|
||||||
// Since we know we're in a React event, we can clear the current
|
// Since we know we're in a React event, we can clear the current
|
||||||
// event time. The next update will compute a new event time.
|
// event time. The next update will compute a new event time.
|
||||||
currentEventTime = NoTimestamp;
|
currentEventTime = NoTimestamp;
|
||||||
|
|
@ -790,6 +791,18 @@ function performConcurrentWorkOnRoot(root) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: We only check `didTimeout` defensively, to account for a Scheduler
|
||||||
|
// bug we're still investigating. Once the bug in Scheduler is fixed,
|
||||||
|
// we can remove this, since we track expiration ourselves.
|
||||||
|
if (!disableSchedulerTimeoutInWorkLoop && didTimeout) {
|
||||||
|
// Something expired. Flush synchronously until there's no expired
|
||||||
|
// work left.
|
||||||
|
markRootExpired(root, lanes);
|
||||||
|
// This will schedule a synchronous callback.
|
||||||
|
ensureRootIsScheduled(root, now());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let exitStatus = renderRootConcurrent(root, lanes);
|
let exitStatus = renderRootConcurrent(root, lanes);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import {
|
||||||
enableSchedulingProfiler,
|
enableSchedulingProfiler,
|
||||||
enableScopeAPI,
|
enableScopeAPI,
|
||||||
skipUnmountedBoundaries,
|
skipUnmountedBoundaries,
|
||||||
|
disableSchedulerTimeoutInWorkLoop,
|
||||||
} from 'shared/ReactFeatureFlags';
|
} from 'shared/ReactFeatureFlags';
|
||||||
import ReactSharedInternals from 'shared/ReactSharedInternals';
|
import ReactSharedInternals from 'shared/ReactSharedInternals';
|
||||||
import invariant from 'shared/invariant';
|
import invariant from 'shared/invariant';
|
||||||
|
|
@ -738,7 +739,7 @@ function ensureRootIsScheduled(root: FiberRoot, currentTime: number) {
|
||||||
|
|
||||||
// This is the entry point for every concurrent task, i.e. anything that
|
// This is the entry point for every concurrent task, i.e. anything that
|
||||||
// goes through Scheduler.
|
// goes through Scheduler.
|
||||||
function performConcurrentWorkOnRoot(root) {
|
function performConcurrentWorkOnRoot(root, didTimeout) {
|
||||||
// Since we know we're in a React event, we can clear the current
|
// Since we know we're in a React event, we can clear the current
|
||||||
// event time. The next update will compute a new event time.
|
// event time. The next update will compute a new event time.
|
||||||
currentEventTime = NoTimestamp;
|
currentEventTime = NoTimestamp;
|
||||||
|
|
@ -778,6 +779,18 @@ function performConcurrentWorkOnRoot(root) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: We only check `didTimeout` defensively, to account for a Scheduler
|
||||||
|
// bug we're still investigating. Once the bug in Scheduler is fixed,
|
||||||
|
// we can remove this, since we track expiration ourselves.
|
||||||
|
if (!disableSchedulerTimeoutInWorkLoop && didTimeout) {
|
||||||
|
// Something expired. Flush synchronously until there's no expired
|
||||||
|
// work left.
|
||||||
|
markRootExpired(root, lanes);
|
||||||
|
// This will schedule a synchronous callback.
|
||||||
|
ensureRootIsScheduled(root, now());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let exitStatus = renderRootConcurrent(root, lanes);
|
let exitStatus = renderRootConcurrent(root, lanes);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -137,3 +137,5 @@ export const enableDiscreteEventFlushingChange = false;
|
||||||
export const enablePassiveEventIntervention = true;
|
export const enablePassiveEventIntervention = true;
|
||||||
|
|
||||||
export const enableEagerRootListeners = true;
|
export const enableEagerRootListeners = true;
|
||||||
|
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ export const decoupleUpdatePriorityFromScheduler = false;
|
||||||
export const enableDiscreteEventFlushingChange = false;
|
export const enableDiscreteEventFlushingChange = false;
|
||||||
export const enablePassiveEventIntervention = true;
|
export const enablePassiveEventIntervention = true;
|
||||||
export const enableEagerRootListeners = true;
|
export const enableEagerRootListeners = true;
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
||||||
|
|
||||||
// Flow magic to verify the exports of this file match the original version.
|
// Flow magic to verify the exports of this file match the original version.
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ export const decoupleUpdatePriorityFromScheduler = false;
|
||||||
export const enableDiscreteEventFlushingChange = false;
|
export const enableDiscreteEventFlushingChange = false;
|
||||||
export const enablePassiveEventIntervention = true;
|
export const enablePassiveEventIntervention = true;
|
||||||
export const enableEagerRootListeners = true;
|
export const enableEagerRootListeners = true;
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
||||||
|
|
||||||
// Flow magic to verify the exports of this file match the original version.
|
// Flow magic to verify the exports of this file match the original version.
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ export const decoupleUpdatePriorityFromScheduler = false;
|
||||||
export const enableDiscreteEventFlushingChange = false;
|
export const enableDiscreteEventFlushingChange = false;
|
||||||
export const enablePassiveEventIntervention = true;
|
export const enablePassiveEventIntervention = true;
|
||||||
export const enableEagerRootListeners = true;
|
export const enableEagerRootListeners = true;
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
||||||
|
|
||||||
// Flow magic to verify the exports of this file match the original version.
|
// Flow magic to verify the exports of this file match the original version.
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ export const decoupleUpdatePriorityFromScheduler = false;
|
||||||
export const enableDiscreteEventFlushingChange = false;
|
export const enableDiscreteEventFlushingChange = false;
|
||||||
export const enablePassiveEventIntervention = true;
|
export const enablePassiveEventIntervention = true;
|
||||||
export const enableEagerRootListeners = true;
|
export const enableEagerRootListeners = true;
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
||||||
|
|
||||||
// Flow magic to verify the exports of this file match the original version.
|
// Flow magic to verify the exports of this file match the original version.
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ export const decoupleUpdatePriorityFromScheduler = false;
|
||||||
export const enableDiscreteEventFlushingChange = false;
|
export const enableDiscreteEventFlushingChange = false;
|
||||||
export const enablePassiveEventIntervention = true;
|
export const enablePassiveEventIntervention = true;
|
||||||
export const enableEagerRootListeners = true;
|
export const enableEagerRootListeners = true;
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
||||||
|
|
||||||
// Flow magic to verify the exports of this file match the original version.
|
// Flow magic to verify the exports of this file match the original version.
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ export const decoupleUpdatePriorityFromScheduler = false;
|
||||||
export const enableDiscreteEventFlushingChange = false;
|
export const enableDiscreteEventFlushingChange = false;
|
||||||
export const enablePassiveEventIntervention = true;
|
export const enablePassiveEventIntervention = true;
|
||||||
export const enableEagerRootListeners = true;
|
export const enableEagerRootListeners = true;
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
||||||
|
|
||||||
// Flow magic to verify the exports of this file match the original version.
|
// Flow magic to verify the exports of this file match the original version.
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ export const decoupleUpdatePriorityFromScheduler = false;
|
||||||
export const enableDiscreteEventFlushingChange = true;
|
export const enableDiscreteEventFlushingChange = true;
|
||||||
export const enablePassiveEventIntervention = true;
|
export const enablePassiveEventIntervention = true;
|
||||||
export const enableEagerRootListeners = true;
|
export const enableEagerRootListeners = true;
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = false;
|
||||||
|
|
||||||
// Flow magic to verify the exports of this file match the original version.
|
// Flow magic to verify the exports of this file match the original version.
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -48,3 +48,4 @@ export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
|
||||||
// to __VARIANT__.
|
// to __VARIANT__.
|
||||||
export const enableTrustedTypesIntegration = false;
|
export const enableTrustedTypesIntegration = false;
|
||||||
export const disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
export const disableSchedulerTimeoutBasedOnReactExpirationTime = false;
|
||||||
|
export const disableSchedulerTimeoutInWorkLoop = __VARIANT__;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export const {
|
||||||
skipUnmountedBoundaries,
|
skipUnmountedBoundaries,
|
||||||
enablePassiveEventIntervention,
|
enablePassiveEventIntervention,
|
||||||
enableEagerRootListeners,
|
enableEagerRootListeners,
|
||||||
|
disableSchedulerTimeoutInWorkLoop,
|
||||||
} = dynamicFeatureFlags;
|
} = dynamicFeatureFlags;
|
||||||
|
|
||||||
// On WWW, __EXPERIMENTAL__ is used for a new modern build.
|
// On WWW, __EXPERIMENTAL__ is used for a new modern build.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user