Skip to content

Commit c96761c

Browse files
authored
Delete batchedEventUpdates (#21774)
No longer used anywhere.
1 parent ae5afb3 commit c96761c

11 files changed

+16
-98
lines changed

packages/react-dom/src/client/ReactDOM.js

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {createRoot, hydrateRoot, isValidContainer} from './ReactDOMRoot';
2121
import {createEventHandle} from './ReactDOMEventHandle';
2222

2323
import {
24-
batchedEventUpdates,
2524
batchedUpdates,
2625
discreteUpdates,
2726
flushDiscreteUpdates,
@@ -102,7 +101,6 @@ setBatchingImplementation(
102101
batchedUpdates,
103102
discreteUpdates,
104103
flushDiscreteUpdates,
105-
batchedEventUpdates,
106104
);
107105

108106
function createPortal(

packages/react-dom/src/events/DOMPluginEventSystem.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import {
4343
getEventHandlerListeners,
4444
} from '../client/ReactDOMComponentTree';
4545
import {COMMENT_NODE} from '../shared/HTMLNodeType';
46-
import {batchedEventUpdates} from './ReactDOMUpdateBatching';
46+
import {batchedUpdates} from './ReactDOMUpdateBatching';
4747
import getListener from './getListener';
4848
import {passiveBrowserEventsSupported} from './checkPassiveEvents';
4949

@@ -630,7 +630,7 @@ export function dispatchEventForPluginEventSystem(
630630
}
631631
}
632632

633-
batchedEventUpdates(() =>
633+
batchedUpdates(() =>
634634
dispatchEventsForPlugins(
635635
domEventName,
636636
eventSystemFlags,

packages/react-dom/src/events/ReactDOMUpdateBatching.js

-9
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ let discreteUpdatesImpl = function(fn, a, b, c, d) {
2424
return fn(a, b, c, d);
2525
};
2626
let flushDiscreteUpdatesImpl = function() {};
27-
// TODO: Remove references to batchedEventUpdates
28-
// let batchedEventUpdatesImpl = batchedUpdatesImpl;
2927

3028
let isInsideEventHandler = false;
31-
// let isBatchingEventUpdates = false;
3229

3330
function finishEventHandler() {
3431
// Here we wait until all updates have propagated, which is important
@@ -62,9 +59,6 @@ export function batchedUpdates(fn, a, b) {
6259
}
6360
}
6461

65-
// TODO: Remove references to batchedEventUpdates
66-
export const batchedEventUpdates = batchedUpdates;
67-
6862
// TODO: Replace with flushSync
6963
export function discreteUpdates(fn, a, b, c, d) {
7064
return discreteUpdatesImpl(fn, a, b, c, d);
@@ -74,11 +68,8 @@ export function setBatchingImplementation(
7468
_batchedUpdatesImpl,
7569
_discreteUpdatesImpl,
7670
_flushDiscreteUpdatesImpl,
77-
_batchedEventUpdatesImpl,
7871
) {
7972
batchedUpdatesImpl = _batchedUpdatesImpl;
8073
discreteUpdatesImpl = _discreteUpdatesImpl;
8174
flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
82-
// TODO: Remove references to batchedEventUpdates
83-
// batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
8475
}

packages/react-native-renderer/src/ReactFabric.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import './ReactFabricInjection';
1616
import {
1717
findHostInstance,
1818
findHostInstanceWithWarning,
19-
batchedEventUpdates,
2019
batchedUpdates as batchedUpdatesImpl,
2120
discreteUpdates,
2221
createContainer,
@@ -246,11 +245,7 @@ function createPortal(
246245
return createPortalImpl(children, containerTag, null, key);
247246
}
248247

249-
setBatchingImplementation(
250-
batchedUpdatesImpl,
251-
discreteUpdates,
252-
batchedEventUpdates,
253-
);
248+
setBatchingImplementation(batchedUpdatesImpl, discreteUpdates);
254249

255250
const roots = new Map();
256251

packages/react-native-renderer/src/ReactNativeRenderer.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
findHostInstance,
1818
findHostInstanceWithWarning,
1919
batchedUpdates as batchedUpdatesImpl,
20-
batchedEventUpdates,
2120
discreteUpdates,
2221
createContainer,
2322
updateContainer,
@@ -237,11 +236,7 @@ function createPortal(
237236
return createPortalImpl(children, containerTag, null, key);
238237
}
239238

240-
setBatchingImplementation(
241-
batchedUpdatesImpl,
242-
discreteUpdates,
243-
batchedEventUpdates,
244-
);
239+
setBatchingImplementation(batchedUpdatesImpl, discreteUpdates);
245240

246241
function computeComponentStackForErrorReporting(reactTag: number): string {
247242
const fiber = getClosestInstanceFromNode(reactTag);

packages/react-native-renderer/src/legacy-events/ReactGenericBatching.js

-18
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ let batchedUpdatesImpl = function(fn, bookkeeping) {
1818
let discreteUpdatesImpl = function(fn, a, b, c, d) {
1919
return fn(a, b, c, d);
2020
};
21-
let batchedEventUpdatesImpl = batchedUpdatesImpl;
2221

2322
let isInsideEventHandler = false;
24-
let isBatchingEventUpdates = false;
2523

2624
export function batchedUpdates(fn, bookkeeping) {
2725
if (isInsideEventHandler) {
@@ -37,20 +35,6 @@ export function batchedUpdates(fn, bookkeeping) {
3735
}
3836
}
3937

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-
5438
export function discreteUpdates(fn, a, b, c, d) {
5539
const prevIsInsideEventHandler = isInsideEventHandler;
5640
isInsideEventHandler = true;
@@ -64,9 +48,7 @@ export function discreteUpdates(fn, a, b, c, d) {
6448
export function setBatchingImplementation(
6549
_batchedUpdatesImpl,
6650
_discreteUpdatesImpl,
67-
_batchedEventUpdatesImpl,
6851
) {
6952
batchedUpdatesImpl = _batchedUpdatesImpl;
7053
discreteUpdatesImpl = _discreteUpdatesImpl;
71-
batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
7254
}

packages/react-reconciler/src/ReactFiberReconciler.js

-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {enableNewReconciler} from 'shared/ReactFeatureFlags';
1717
import {
1818
createContainer as createContainer_old,
1919
updateContainer as updateContainer_old,
20-
batchedEventUpdates as batchedEventUpdates_old,
2120
batchedUpdates as batchedUpdates_old,
2221
unbatchedUpdates as unbatchedUpdates_old,
2322
deferredUpdates as deferredUpdates_old,
@@ -56,7 +55,6 @@ import {
5655
import {
5756
createContainer as createContainer_new,
5857
updateContainer as updateContainer_new,
59-
batchedEventUpdates as batchedEventUpdates_new,
6058
batchedUpdates as batchedUpdates_new,
6159
unbatchedUpdates as unbatchedUpdates_new,
6260
deferredUpdates as deferredUpdates_new,
@@ -98,9 +96,6 @@ export const createContainer = enableNewReconciler
9896
export const updateContainer = enableNewReconciler
9997
? updateContainer_new
10098
: updateContainer_old;
101-
export const batchedEventUpdates = enableNewReconciler
102-
? batchedEventUpdates_new
103-
: batchedEventUpdates_old;
10499
export const batchedUpdates = enableNewReconciler
105100
? batchedUpdates_new
106101
: batchedUpdates_old;

packages/react-reconciler/src/ReactFiberReconciler.new.js

-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import {
5151
requestUpdateLane,
5252
scheduleUpdateOnFiber,
5353
flushRoot,
54-
batchedEventUpdates,
5554
batchedUpdates,
5655
unbatchedUpdates,
5756
flushSync,
@@ -327,7 +326,6 @@ export function updateContainer(
327326
}
328327

329328
export {
330-
batchedEventUpdates,
331329
batchedUpdates,
332330
unbatchedUpdates,
333331
deferredUpdates,

packages/react-reconciler/src/ReactFiberReconciler.old.js

-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import {
5151
requestUpdateLane,
5252
scheduleUpdateOnFiber,
5353
flushRoot,
54-
batchedEventUpdates,
5554
batchedUpdates,
5655
unbatchedUpdates,
5756
flushSync,
@@ -327,7 +326,6 @@ export function updateContainer(
327326
}
328327

329328
export {
330-
batchedEventUpdates,
331329
batchedUpdates,
332330
unbatchedUpdates,
333331
deferredUpdates,

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

+6-23
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,12 @@ const {
246246

247247
type ExecutionContext = number;
248248

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;
256255

257256
type RootExitStatus = 0 | 1 | 2 | 3 | 4 | 5;
258257
const RootIncomplete = 0;
@@ -1102,22 +1101,6 @@ export function batchedUpdates<A, R>(fn: A => R, a: A): R {
11021101
}
11031102
}
11041103

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-
11211104
export function discreteUpdates<A, B, C, D, R>(
11221105
fn: (A, B, C, D) => R,
11231106
a: A,

packages/react-reconciler/src/ReactFiberWorkLoop.old.js

+6-23
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,12 @@ const {
246246

247247
type ExecutionContext = number;
248248

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;
256255

257256
type RootExitStatus = 0 | 1 | 2 | 3 | 4 | 5;
258257
const RootIncomplete = 0;
@@ -1102,22 +1101,6 @@ export function batchedUpdates<A, R>(fn: A => R, a: A): R {
11021101
}
11031102
}
11041103

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-
11211104
export function discreteUpdates<A, B, C, D, R>(
11221105
fn: (A, B, C, D) => R,
11231106
a: A,

0 commit comments

Comments
 (0)