@samitouri / QOS-React-2 / commits / c96761c7b2

Delete batchedEventUpdates (#21774)

No longer used anywhere.

Andrew Clark committed Jun 30, 2021 at 18:09 UTC c96761c7b217989a6c377c9b12249a78b0be91f9
11 files changed +16 -98
packages/react-dom/src/client/ReactDOM.js
-2
@@ -21,7 +21,6 @@ import {createRoot, hydrateRoot, isValidContainer} from './ReactDOMRoot';
21 import {createEventHandle} from './ReactDOMEventHandle';
22
23 import {
24 - batchedEventUpdates,
24 batchedUpdates,
25 discreteUpdates,
26 flushDiscreteUpdates,
@@ -102,7 +101,6 @@ setBatchingImplementation(
101 batchedUpdates,
102 discreteUpdates,
103 flushDiscreteUpdates,
105 - batchedEventUpdates,
104 );
105
106 function createPortal(
packages/react-dom/src/events/DOMPluginEventSystem.js
+2 -2
@@ -43,7 +43,7 @@ import {
43 getEventHandlerListeners,
44 } from '../client/ReactDOMComponentTree';
45 import {COMMENT_NODE} from '../shared/HTMLNodeType';
46 -import {batchedEventUpdates} from './ReactDOMUpdateBatching';
46 +import {batchedUpdates} from './ReactDOMUpdateBatching';
47 import getListener from './getListener';
48 import {passiveBrowserEventsSupported} from './checkPassiveEvents';
49
@@ -630,7 +630,7 @@ export function dispatchEventForPluginEventSystem(
630 }
631 }
632
633 - batchedEventUpdates(() =>
633 + batchedUpdates(() =>
634 dispatchEventsForPlugins(
635 domEventName,
636 eventSystemFlags,
packages/react-dom/src/events/ReactDOMUpdateBatching.js
-9
@@ -24,11 +24,8 @@ let discreteUpdatesImpl = function(fn, a, b, c, d) {
24 return fn(a, b, c, d);
25 };
26 let flushDiscreteUpdatesImpl = function() {};
27 -// TODO: Remove references to batchedEventUpdates
28 -// let batchedEventUpdatesImpl = batchedUpdatesImpl;
27
28 let isInsideEventHandler = false;
31 -// let isBatchingEventUpdates = false;
29
30 function finishEventHandler() {
31 // Here we wait until all updates have propagated, which is important
@@ -62,9 +59,6 @@ export function batchedUpdates(fn, a, b) {
59 }
60 }
61
65 -// TODO: Remove references to batchedEventUpdates
66 -export const batchedEventUpdates = batchedUpdates;
67 -
62 // TODO: Replace with flushSync
63 export function discreteUpdates(fn, a, b, c, d) {
64 return discreteUpdatesImpl(fn, a, b, c, d);
@@ -74,11 +68,8 @@ export function setBatchingImplementation(
68 _batchedUpdatesImpl,
69 _discreteUpdatesImpl,
70 _flushDiscreteUpdatesImpl,
77 - _batchedEventUpdatesImpl,
71 ) {
72 batchedUpdatesImpl = _batchedUpdatesImpl;
73 discreteUpdatesImpl = _discreteUpdatesImpl;
74 flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
82 - // TODO: Remove references to batchedEventUpdates
83 - // batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
75 }
packages/react-native-renderer/src/ReactFabric.js
+1 -6
@@ -16,7 +16,6 @@ import './ReactFabricInjection';
16 import {
17 findHostInstance,
18 findHostInstanceWithWarning,
19 - batchedEventUpdates,
19 batchedUpdates as batchedUpdatesImpl,
20 discreteUpdates,
21 createContainer,
@@ -246,11 +245,7 @@ function createPortal(
245 return createPortalImpl(children, containerTag, null, key);
246 }
247
249 -setBatchingImplementation(
250 - batchedUpdatesImpl,
251 - discreteUpdates,
252 - batchedEventUpdates,
253 -);
248 +setBatchingImplementation(batchedUpdatesImpl, discreteUpdates);
249
250 const roots = new Map();
251
packages/react-native-renderer/src/ReactNativeRenderer.js
+1 -6
@@ -17,7 +17,6 @@ import {
17 findHostInstance,
18 findHostInstanceWithWarning,
19 batchedUpdates as batchedUpdatesImpl,
20 - batchedEventUpdates,
20 discreteUpdates,
21 createContainer,
22 updateContainer,
@@ -237,11 +236,7 @@ function createPortal(
236 return createPortalImpl(children, containerTag, null, key);
237 }
238
240 -setBatchingImplementation(
241 - batchedUpdatesImpl,
242 - discreteUpdates,
243 - batchedEventUpdates,
244 -);
239 +setBatchingImplementation(batchedUpdatesImpl, discreteUpdates);
240
241 function computeComponentStackForErrorReporting(reactTag: number): string {
242 const fiber = getClosestInstanceFromNode(reactTag);
packages/react-native-renderer/src/legacy-events/ReactGenericBatching.js
-18
@@ -18,10 +18,8 @@ let batchedUpdatesImpl = function(fn, bookkeeping) {
18 let discreteUpdatesImpl = function(fn, a, b, c, d) {
19 return fn(a, b, c, d);
20 };
21 -let batchedEventUpdatesImpl = batchedUpdatesImpl;
21
22 let isInsideEventHandler = false;
24 -let isBatchingEventUpdates = false;
23
24 export function batchedUpdates(fn, bookkeeping) {
25 if (isInsideEventHandler) {
@@ -37,20 +35,6 @@ export function batchedUpdates(fn, bookkeeping) {
35 }
36 }
37
40 -export function batchedEventUpdates(fn, a, b) {
41 - if (isBatchingEventUpdates) {
42 - // If we are currently inside another batch, we need to wait until it
43 - // fully completes before restoring state.
44 - return fn(a, b);
45 - }
46 - isBatchingEventUpdates = true;
47 - try {
48 - return batchedEventUpdatesImpl(fn, a, b);
49 - } finally {
50 - isBatchingEventUpdates = false;
51 - }
52 -}
53 -
38 export function discreteUpdates(fn, a, b, c, d) {
39 const prevIsInsideEventHandler = isInsideEventHandler;
40 isInsideEventHandler = true;
@@ -64,9 +48,7 @@ export function discreteUpdates(fn, a, b, c, d) {
48 export function setBatchingImplementation(
49 _batchedUpdatesImpl,
50 _discreteUpdatesImpl,
67 - _batchedEventUpdatesImpl,
51 ) {
52 batchedUpdatesImpl = _batchedUpdatesImpl;
53 discreteUpdatesImpl = _discreteUpdatesImpl;
71 - batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
54 }
packages/react-reconciler/src/ReactFiberReconciler.js
-5
@@ -17,7 +17,6 @@ import {enableNewReconciler} from 'shared/ReactFeatureFlags';
17 import {
18 createContainer as createContainer_old,
19 updateContainer as updateContainer_old,
20 - batchedEventUpdates as batchedEventUpdates_old,
20 batchedUpdates as batchedUpdates_old,
21 unbatchedUpdates as unbatchedUpdates_old,
22 deferredUpdates as deferredUpdates_old,
@@ -56,7 +55,6 @@ import {
55 import {
56 createContainer as createContainer_new,
57 updateContainer as updateContainer_new,
59 - batchedEventUpdates as batchedEventUpdates_new,
58 batchedUpdates as batchedUpdates_new,
59 unbatchedUpdates as unbatchedUpdates_new,
60 deferredUpdates as deferredUpdates_new,
@@ -98,9 +96,6 @@ export const createContainer = enableNewReconciler
96 export const updateContainer = enableNewReconciler
97 ? updateContainer_new
98 : updateContainer_old;
101 -export const batchedEventUpdates = enableNewReconciler
102 - ? batchedEventUpdates_new
103 - : batchedEventUpdates_old;
99 export const batchedUpdates = enableNewReconciler
100 ? batchedUpdates_new
101 : batchedUpdates_old;
packages/react-reconciler/src/ReactFiberReconciler.new.js
-2
@@ -51,7 +51,6 @@ import {
51 requestUpdateLane,
52 scheduleUpdateOnFiber,
53 flushRoot,
54 - batchedEventUpdates,
54 batchedUpdates,
55 unbatchedUpdates,
56 flushSync,
@@ -327,7 +326,6 @@ export function updateContainer(
326 }
327
328 export {
330 - batchedEventUpdates,
329 batchedUpdates,
330 unbatchedUpdates,
331 deferredUpdates,
packages/react-reconciler/src/ReactFiberReconciler.old.js
-2
@@ -51,7 +51,6 @@ import {
51 requestUpdateLane,
52 scheduleUpdateOnFiber,
53 flushRoot,
54 - batchedEventUpdates,
54 batchedUpdates,
55 unbatchedUpdates,
56 flushSync,
@@ -327,7 +326,6 @@ export function updateContainer(
326 }
327
328 export {
330 - batchedEventUpdates,
329 batchedUpdates,
330 unbatchedUpdates,
331 deferredUpdates,
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+6 -23
@@ -246,13 +246,12 @@ const {
246
247 type ExecutionContext = number;
248
249 -export const NoContext = /* */ 0b000000;
250 -const BatchedContext = /* */ 0b000001;
251 -const EventContext = /* */ 0b000010;
252 -const LegacyUnbatchedContext = /* */ 0b000100;
253 -const RenderContext = /* */ 0b001000;
254 -const CommitContext = /* */ 0b010000;
255 -export const RetryAfterError = /* */ 0b100000;
249 +export const NoContext = /* */ 0b00000;
250 +const BatchedContext = /* */ 0b00001;
251 +const LegacyUnbatchedContext = /* */ 0b00010;
252 +const RenderContext = /* */ 0b00100;
253 +const CommitContext = /* */ 0b01000;
254 +export const RetryAfterError = /* */ 0b10000;
255
256 type RootExitStatus = 0 | 1 | 2 | 3 | 4 | 5;
257 const RootIncomplete = 0;
@@ -1102,22 +1101,6 @@ export function batchedUpdates<A, R>(fn: A => R, a: A): R {
1101 }
1102 }
1103
1105 -export function batchedEventUpdates<A, R>(fn: A => R, a: A): R {
1106 - const prevExecutionContext = executionContext;
1107 - executionContext |= EventContext;
1108 - try {
1109 - return fn(a);
1110 - } finally {
1111 - executionContext = prevExecutionContext;
1112 - // If there were legacy sync updates, flush them at the end of the outer
1113 - // most batchedUpdates-like method.
1114 - if (executionContext === NoContext) {
1115 - resetRenderTimer();
1116 - flushSyncCallbacksOnlyInLegacyMode();
1117 - }
1118 - }
1119 -}
1120 -
1104 export function discreteUpdates<A, B, C, D, R>(
1105 fn: (A, B, C, D) => R,
1106 a: A,
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+6 -23
@@ -246,13 +246,12 @@ const {
246
247 type ExecutionContext = number;
248
249 -export const NoContext = /* */ 0b000000;
250 -const BatchedContext = /* */ 0b000001;
251 -const EventContext = /* */ 0b000010;
252 -const LegacyUnbatchedContext = /* */ 0b000100;
253 -const RenderContext = /* */ 0b001000;
254 -const CommitContext = /* */ 0b010000;
255 -export const RetryAfterError = /* */ 0b100000;
249 +export const NoContext = /* */ 0b00000;
250 +const BatchedContext = /* */ 0b00001;
251 +const LegacyUnbatchedContext = /* */ 0b00010;
252 +const RenderContext = /* */ 0b00100;
253 +const CommitContext = /* */ 0b01000;
254 +export const RetryAfterError = /* */ 0b10000;
255
256 type RootExitStatus = 0 | 1 | 2 | 3 | 4 | 5;
257 const RootIncomplete = 0;
@@ -1102,22 +1101,6 @@ export function batchedUpdates<A, R>(fn: A => R, a: A): R {
1101 }
1102 }
1103
1105 -export function batchedEventUpdates<A, R>(fn: A => R, a: A): R {
1106 - const prevExecutionContext = executionContext;
1107 - executionContext |= EventContext;
1108 - try {
1109 - return fn(a);
1110 - } finally {
1111 - executionContext = prevExecutionContext;
1112 - // If there were legacy sync updates, flush them at the end of the outer
1113 - // most batchedUpdates-like method.
1114 - if (executionContext === NoContext) {
1115 - resetRenderTimer();
1116 - flushSyncCallbacksOnlyInLegacyMode();
1117 - }
1118 - }
1119 -}
1120 -
1104 export function discreteUpdates<A, B, C, D, R>(
1105 fn: (A, B, C, D) => R,
1106 a: A,