Skip to content

Commit

Permalink
Inline discreteUpdates (facebook#21784)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
acdlite authored and zhengjitf committed Apr 15, 2022
1 parent 886ced0 commit 9eba392
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/react-dom/src/events/ReactDOMEventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import getEventTarget from './getEventTarget';
import {getClosestInstanceFromNode} from '../client/ReactDOMComponentTree';

import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem';
import {discreteUpdates} from './ReactDOMUpdateBatching';

import {
getCurrentPriorityLevel as getCurrentSchedulerPriorityLevel,
Expand Down Expand Up @@ -112,13 +111,16 @@ function dispatchDiscreteEvent(
container,
nativeEvent,
) {
discreteUpdates(
dispatchEvent,
domEventName,
eventSystemFlags,
container,
nativeEvent,
);
const previousPriority = getCurrentUpdatePriority();
const prevTransition = ReactCurrentBatchConfig.transition;
ReactCurrentBatchConfig.transition = 0;
try {
setCurrentUpdatePriority(DiscreteEventPriority);
dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent);
} finally {
setCurrentUpdatePriority(previousPriority);
ReactCurrentBatchConfig.transition = prevTransition;
}
}

function dispatchContinuousEvent(
Expand Down

0 comments on commit 9eba392

Please sign in to comment.