diff --git a/packages/react-dom/src/client/ReactDOM.js b/packages/react-dom/src/client/ReactDOM.js
index f2affc78a58cb..8e974697075f1 100644
--- a/packages/react-dom/src/client/ReactDOM.js
+++ b/packages/react-dom/src/client/ReactDOM.js
@@ -21,7 +21,6 @@ import {createRoot, hydrateRoot, isValidContainer} from './ReactDOMRoot';
import {createEventHandle} from './ReactDOMEventHandle';
import {
- batchedEventUpdates,
batchedUpdates,
discreteUpdates,
flushDiscreteUpdates,
@@ -102,7 +101,6 @@ setBatchingImplementation(
batchedUpdates,
discreteUpdates,
flushDiscreteUpdates,
- batchedEventUpdates,
);
function createPortal(
diff --git a/packages/react-dom/src/events/DOMPluginEventSystem.js b/packages/react-dom/src/events/DOMPluginEventSystem.js
index b2c118d3cea89..0583916988e06 100644
--- a/packages/react-dom/src/events/DOMPluginEventSystem.js
+++ b/packages/react-dom/src/events/DOMPluginEventSystem.js
@@ -43,7 +43,7 @@ import {
getEventHandlerListeners,
} from '../client/ReactDOMComponentTree';
import {COMMENT_NODE} from '../shared/HTMLNodeType';
-import {batchedEventUpdates} from './ReactDOMUpdateBatching';
+import {batchedUpdates} from './ReactDOMUpdateBatching';
import getListener from './getListener';
import {passiveBrowserEventsSupported} from './checkPassiveEvents';
@@ -630,7 +630,7 @@ export function dispatchEventForPluginEventSystem(
}
}
- batchedEventUpdates(() =>
+ batchedUpdates(() =>
dispatchEventsForPlugins(
domEventName,
eventSystemFlags,
diff --git a/packages/react-dom/src/events/ReactDOMUpdateBatching.js b/packages/react-dom/src/events/ReactDOMUpdateBatching.js
index 3fb8214fc690e..f2fbfe4c3f329 100644
--- a/packages/react-dom/src/events/ReactDOMUpdateBatching.js
+++ b/packages/react-dom/src/events/ReactDOMUpdateBatching.js
@@ -24,11 +24,8 @@ let discreteUpdatesImpl = function(fn, a, b, c, d) {
return fn(a, b, c, d);
};
let flushDiscreteUpdatesImpl = function() {};
-// TODO: Remove references to batchedEventUpdates
-// let batchedEventUpdatesImpl = batchedUpdatesImpl;
let isInsideEventHandler = false;
-// let isBatchingEventUpdates = false;
function finishEventHandler() {
// Here we wait until all updates have propagated, which is important
@@ -62,9 +59,6 @@ export function batchedUpdates(fn, a, b) {
}
}
-// TODO: Remove references to batchedEventUpdates
-export const batchedEventUpdates = batchedUpdates;
-
// TODO: Replace with flushSync
export function discreteUpdates(fn, a, b, c, d) {
return discreteUpdatesImpl(fn, a, b, c, d);
@@ -74,11 +68,8 @@ export function setBatchingImplementation(
_batchedUpdatesImpl,
_discreteUpdatesImpl,
_flushDiscreteUpdatesImpl,
- _batchedEventUpdatesImpl,
) {
batchedUpdatesImpl = _batchedUpdatesImpl;
discreteUpdatesImpl = _discreteUpdatesImpl;
flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
- // TODO: Remove references to batchedEventUpdates
- // batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
}
diff --git a/packages/react-native-renderer/src/ReactFabric.js b/packages/react-native-renderer/src/ReactFabric.js
index 040e02e093e47..c79868af51f0e 100644
--- a/packages/react-native-renderer/src/ReactFabric.js
+++ b/packages/react-native-renderer/src/ReactFabric.js
@@ -16,7 +16,6 @@ import './ReactFabricInjection';
import {
findHostInstance,
findHostInstanceWithWarning,
- batchedEventUpdates,
batchedUpdates as batchedUpdatesImpl,
discreteUpdates,
createContainer,
@@ -246,11 +245,7 @@ function createPortal(
return createPortalImpl(children, containerTag, null, key);
}
-setBatchingImplementation(
- batchedUpdatesImpl,
- discreteUpdates,
- batchedEventUpdates,
-);
+setBatchingImplementation(batchedUpdatesImpl, discreteUpdates);
const roots = new Map();
diff --git a/packages/react-native-renderer/src/ReactNativeRenderer.js b/packages/react-native-renderer/src/ReactNativeRenderer.js
index 6f12fd5d8d445..fdb1c05fed94f 100644
--- a/packages/react-native-renderer/src/ReactNativeRenderer.js
+++ b/packages/react-native-renderer/src/ReactNativeRenderer.js
@@ -17,7 +17,6 @@ import {
findHostInstance,
findHostInstanceWithWarning,
batchedUpdates as batchedUpdatesImpl,
- batchedEventUpdates,
discreteUpdates,
createContainer,
updateContainer,
@@ -237,11 +236,7 @@ function createPortal(
return createPortalImpl(children, containerTag, null, key);
}
-setBatchingImplementation(
- batchedUpdatesImpl,
- discreteUpdates,
- batchedEventUpdates,
-);
+setBatchingImplementation(batchedUpdatesImpl, discreteUpdates);
function computeComponentStackForErrorReporting(reactTag: number): string {
const fiber = getClosestInstanceFromNode(reactTag);
diff --git a/packages/react-native-renderer/src/legacy-events/ReactGenericBatching.js b/packages/react-native-renderer/src/legacy-events/ReactGenericBatching.js
index 3b30bb274ff1b..f0f0705c1fc5a 100644
--- a/packages/react-native-renderer/src/legacy-events/ReactGenericBatching.js
+++ b/packages/react-native-renderer/src/legacy-events/ReactGenericBatching.js
@@ -18,10 +18,8 @@ let batchedUpdatesImpl = function(fn, bookkeeping) {
let discreteUpdatesImpl = function(fn, a, b, c, d) {
return fn(a, b, c, d);
};
-let batchedEventUpdatesImpl = batchedUpdatesImpl;
let isInsideEventHandler = false;
-let isBatchingEventUpdates = false;
export function batchedUpdates(fn, bookkeeping) {
if (isInsideEventHandler) {
@@ -37,20 +35,6 @@ export function batchedUpdates(fn, bookkeeping) {
}
}
-export function batchedEventUpdates(fn, a, b) {
- if (isBatchingEventUpdates) {
- // If we are currently inside another batch, we need to wait until it
- // fully completes before restoring state.
- return fn(a, b);
- }
- isBatchingEventUpdates = true;
- try {
- return batchedEventUpdatesImpl(fn, a, b);
- } finally {
- isBatchingEventUpdates = false;
- }
-}
-
export function discreteUpdates(fn, a, b, c, d) {
const prevIsInsideEventHandler = isInsideEventHandler;
isInsideEventHandler = true;
@@ -64,9 +48,7 @@ export function discreteUpdates(fn, a, b, c, d) {
export function setBatchingImplementation(
_batchedUpdatesImpl,
_discreteUpdatesImpl,
- _batchedEventUpdatesImpl,
) {
batchedUpdatesImpl = _batchedUpdatesImpl;
discreteUpdatesImpl = _discreteUpdatesImpl;
- batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
}
diff --git a/packages/react-reconciler/src/ReactFiberReconciler.js b/packages/react-reconciler/src/ReactFiberReconciler.js
index 7f1a53522da53..bc169fd8a6475 100644
--- a/packages/react-reconciler/src/ReactFiberReconciler.js
+++ b/packages/react-reconciler/src/ReactFiberReconciler.js
@@ -17,7 +17,6 @@ import {enableNewReconciler} from 'shared/ReactFeatureFlags';
import {
createContainer as createContainer_old,
updateContainer as updateContainer_old,
- batchedEventUpdates as batchedEventUpdates_old,
batchedUpdates as batchedUpdates_old,
unbatchedUpdates as unbatchedUpdates_old,
deferredUpdates as deferredUpdates_old,
@@ -56,7 +55,6 @@ import {
import {
createContainer as createContainer_new,
updateContainer as updateContainer_new,
- batchedEventUpdates as batchedEventUpdates_new,
batchedUpdates as batchedUpdates_new,
unbatchedUpdates as unbatchedUpdates_new,
deferredUpdates as deferredUpdates_new,
@@ -98,9 +96,6 @@ export const createContainer = enableNewReconciler
export const updateContainer = enableNewReconciler
? updateContainer_new
: updateContainer_old;
-export const batchedEventUpdates = enableNewReconciler
- ? batchedEventUpdates_new
- : batchedEventUpdates_old;
export const batchedUpdates = enableNewReconciler
? batchedUpdates_new
: batchedUpdates_old;
diff --git a/packages/react-reconciler/src/ReactFiberReconciler.new.js b/packages/react-reconciler/src/ReactFiberReconciler.new.js
index 1c549125a43dd..f406f8592b0d1 100644
--- a/packages/react-reconciler/src/ReactFiberReconciler.new.js
+++ b/packages/react-reconciler/src/ReactFiberReconciler.new.js
@@ -51,7 +51,6 @@ import {
requestUpdateLane,
scheduleUpdateOnFiber,
flushRoot,
- batchedEventUpdates,
batchedUpdates,
unbatchedUpdates,
flushSync,
@@ -327,7 +326,6 @@ export function updateContainer(
}
export {
- batchedEventUpdates,
batchedUpdates,
unbatchedUpdates,
deferredUpdates,
diff --git a/packages/react-reconciler/src/ReactFiberReconciler.old.js b/packages/react-reconciler/src/ReactFiberReconciler.old.js
index f57b1f84814c4..f6ae425b4400b 100644
--- a/packages/react-reconciler/src/ReactFiberReconciler.old.js
+++ b/packages/react-reconciler/src/ReactFiberReconciler.old.js
@@ -51,7 +51,6 @@ import {
requestUpdateLane,
scheduleUpdateOnFiber,
flushRoot,
- batchedEventUpdates,
batchedUpdates,
unbatchedUpdates,
flushSync,
@@ -327,7 +326,6 @@ export function updateContainer(
}
export {
- batchedEventUpdates,
batchedUpdates,
unbatchedUpdates,
deferredUpdates,
diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js
index 6ce1337299794..7f429c873438a 100644
--- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js
@@ -246,13 +246,12 @@ const {
type ExecutionContext = number;
-export const NoContext = /* */ 0b000000;
-const BatchedContext = /* */ 0b000001;
-const EventContext = /* */ 0b000010;
-const LegacyUnbatchedContext = /* */ 0b000100;
-const RenderContext = /* */ 0b001000;
-const CommitContext = /* */ 0b010000;
-export const RetryAfterError = /* */ 0b100000;
+export const NoContext = /* */ 0b00000;
+const BatchedContext = /* */ 0b00001;
+const LegacyUnbatchedContext = /* */ 0b00010;
+const RenderContext = /* */ 0b00100;
+const CommitContext = /* */ 0b01000;
+export const RetryAfterError = /* */ 0b10000;
type RootExitStatus = 0 | 1 | 2 | 3 | 4 | 5;
const RootIncomplete = 0;
@@ -1102,22 +1101,6 @@ export function batchedUpdates(fn: A => R, a: A): R {
}
}
-export function batchedEventUpdates(fn: A => R, a: A): R {
- const prevExecutionContext = executionContext;
- executionContext |= EventContext;
- try {
- return fn(a);
- } finally {
- executionContext = prevExecutionContext;
- // If there were legacy sync updates, flush them at the end of the outer
- // most batchedUpdates-like method.
- if (executionContext === NoContext) {
- resetRenderTimer();
- flushSyncCallbacksOnlyInLegacyMode();
- }
- }
-}
-
export function discreteUpdates(
fn: (A, B, C, D) => R,
a: A,
diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js
index b99245f097d17..f356fc3f1156a 100644
--- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js
@@ -246,13 +246,12 @@ const {
type ExecutionContext = number;
-export const NoContext = /* */ 0b000000;
-const BatchedContext = /* */ 0b000001;
-const EventContext = /* */ 0b000010;
-const LegacyUnbatchedContext = /* */ 0b000100;
-const RenderContext = /* */ 0b001000;
-const CommitContext = /* */ 0b010000;
-export const RetryAfterError = /* */ 0b100000;
+export const NoContext = /* */ 0b00000;
+const BatchedContext = /* */ 0b00001;
+const LegacyUnbatchedContext = /* */ 0b00010;
+const RenderContext = /* */ 0b00100;
+const CommitContext = /* */ 0b01000;
+export const RetryAfterError = /* */ 0b10000;
type RootExitStatus = 0 | 1 | 2 | 3 | 4 | 5;
const RootIncomplete = 0;
@@ -1102,22 +1101,6 @@ export function batchedUpdates(fn: A => R, a: A): R {
}
}
-export function batchedEventUpdates(fn: A => R, a: A): R {
- const prevExecutionContext = executionContext;
- executionContext |= EventContext;
- try {
- return fn(a);
- } finally {
- executionContext = prevExecutionContext;
- // If there were legacy sync updates, flush them at the end of the outer
- // most batchedUpdates-like method.
- if (executionContext === NoContext) {
- resetRenderTimer();
- flushSyncCallbacksOnlyInLegacyMode();
- }
- }
-}
-
export function discreteUpdates(
fn: (A, B, C, D) => R,
a: A,