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

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.

Andrew Clark committed Jul 12, 2021 at 10:55 UTC bfa50f827241300d6674eeb99b9efab1ac9a5c40
1 file changed +10 -8
packages/react-dom/src/events/ReactDOMEventListener.js
+10 -8
@@ -31,7 +31,6 @@ import getEventTarget from './getEventTarget';
31 import {getClosestInstanceFromNode} from '../client/ReactDOMComponentTree';
32
33 import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem';
34 -import {discreteUpdates} from './ReactDOMUpdateBatching';
34
35 import {
36 getCurrentPriorityLevel as getCurrentSchedulerPriorityLevel,
@@ -112,13 +111,16 @@ function dispatchDiscreteEvent(
111 container,
112 nativeEvent,
113 ) {
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 + }
124 }
125
126 function dispatchContinuousEvent(