Skip to content

Commit bfa50f8

Browse files
authored
Inline discreteUpdates (#21784)
This API is only used by the event system, to set the event priority for the scope of a function. We don't need it anymore because we can modify the priority directly, like we already do for continuous input events.
1 parent 0f09f14 commit bfa50f8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

+10-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import getEventTarget from './getEventTarget';
3131
import {getClosestInstanceFromNode} from '../client/ReactDOMComponentTree';
3232

3333
import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem';
34-
import {discreteUpdates} from './ReactDOMUpdateBatching';
3534

3635
import {
3736
getCurrentPriorityLevel as getCurrentSchedulerPriorityLevel,
@@ -112,13 +111,16 @@ function dispatchDiscreteEvent(
112111
container,
113112
nativeEvent,
114113
) {
115-
discreteUpdates(
116-
dispatchEvent,
117-
domEventName,
118-
eventSystemFlags,
119-
container,
120-
nativeEvent,
121-
);
114+
const previousPriority = getCurrentUpdatePriority();
115+
const prevTransition = ReactCurrentBatchConfig.transition;
116+
ReactCurrentBatchConfig.transition = 0;
117+
try {
118+
setCurrentUpdatePriority(DiscreteEventPriority);
119+
dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent);
120+
} finally {
121+
setCurrentUpdatePriority(previousPriority);
122+
ReactCurrentBatchConfig.transition = prevTransition;
123+
}
122124
}
123125

124126
function dispatchContinuousEvent(

0 commit comments

Comments
 (0)