Remove passive intervention flag (#19849)

This commit is contained in:
Dan Abramov
2020-09-17 15:37:12 +01:00
committed by GitHub
parent 36df9185c5
commit 6fddca27e7
13 changed files with 12 additions and 37 deletions
+1 -2
View File
@@ -51,7 +51,6 @@ import {
enableLegacyFBSupport,
enableCreateEventHandleAPI,
enableScopeAPI,
enablePassiveEventIntervention,
enableEagerRootListeners,
} from 'shared/ReactFeatureFlags';
import {
@@ -481,7 +480,7 @@ function addTrappedEventListener(
// If passive option is not supported, then the event will be
// active and not passive.
let isPassiveListener = undefined;
if (enablePassiveEventIntervention && passiveBrowserEventsSupported) {
if (passiveBrowserEventsSupported) {
// Browsers introduced an intervention, making these events
// passive by default on document. React doesn't bind them
// to document anymore, but changing this now would undo
@@ -3070,15 +3070,7 @@ describe('DOMPluginEventSystem', () => {
expect(allEvents).toEqual(['touchstart', 'touchmove', 'wheel']);
// These events are passive by default, so we can't preventDefault.
if (gate(flags => flags.enablePassiveEventIntervention)) {
expect(defaultPreventedEvents).toEqual([]);
} else {
expect(defaultPreventedEvents).toEqual([
'touchstart',
'touchmove',
'wheel',
]);
}
expect(defaultPreventedEvents).toEqual([]);
});
});
});
@@ -534,21 +534,17 @@ describe('SimpleEventPlugin', function() {
container,
);
if (gate(flags => flags.enablePassiveEventIntervention)) {
if (gate(flags => flags.enableEagerRootListeners)) {
expect(passiveEvents).toEqual([
'touchstart',
'touchstart',
'touchmove',
'touchmove',
'wheel',
'wheel',
]);
} else {
expect(passiveEvents).toEqual(['touchstart', 'touchmove', 'wheel']);
}
if (gate(flags => flags.enableEagerRootListeners)) {
expect(passiveEvents).toEqual([
'touchstart',
'touchstart',
'touchmove',
'touchmove',
'wheel',
'wheel',
]);
} else {
expect(passiveEvents).toEqual([]);
expect(passiveEvents).toEqual(['touchstart', 'touchmove', 'wheel']);
}
});
});
-3
View File
@@ -133,9 +133,6 @@ export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
// https://github.com/facebook/react/pull/19654
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;
@@ -49,7 +49,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;
@@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;
@@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;
@@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;
@@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;
@@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = false;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;
@@ -48,7 +48,6 @@ export const enableNewReconciler = false;
export const deferRenderPhaseUpdateToNextBatch = true;
export const decoupleUpdatePriorityFromScheduler = false;
export const enableDiscreteEventFlushingChange = true;
export const enablePassiveEventIntervention = true;
export const enableEagerRootListeners = true;
export const disableSchedulerTimeoutInWorkLoop = false;
@@ -19,7 +19,6 @@ export const enableFilterEmptyStringAttributesDOM = __VARIANT__;
export const enableLegacyFBSupport = __VARIANT__;
export const decoupleUpdatePriorityFromScheduler = __VARIANT__;
export const skipUnmountedBoundaries = __VARIANT__;
export const enablePassiveEventIntervention = __VARIANT__;
export const enableEagerRootListeners = !__VARIANT__;
// Enable this flag to help with concurrent mode debugging.
@@ -27,7 +27,6 @@ export const {
decoupleUpdatePriorityFromScheduler,
enableDebugTracing,
skipUnmountedBoundaries,
enablePassiveEventIntervention,
enableEagerRootListeners,
disableSchedulerTimeoutInWorkLoop,
} = dynamicFeatureFlags;