@samitouri / QOS-React / commits / b4608dd24c

Remove unused simulated flag parameter (#14127)

Nadav Kaner committed Nov 7, 2018 at 03:33 UTC b4608dd24caa31b3c78c51acbb5115ad03e884b3
5 files changed +12 -36
packages/events/EventPluginHub.js
+5 -23
@@ -37,26 +37,19 @@ let eventQueue: ?(Array<ReactSyntheticEvent> | ReactSyntheticEvent) = null;
37 * Dispatches an event and releases it back into the pool, unless persistent.
38 *
39 * @param {?object} event Synthetic event to be dispatched.
40 - * @param {boolean} simulated If the event is simulated (changes exn behavior)
40 * @private
41 */
43 -const executeDispatchesAndRelease = function(
44 - event: ReactSyntheticEvent,
45 - simulated: boolean,
46 -) {
42 +const executeDispatchesAndRelease = function(event: ReactSyntheticEvent) {
43 if (event) {
48 - executeDispatchesInOrder(event, simulated);
44 + executeDispatchesInOrder(event);
45
46 if (!event.isPersistent()) {
47 event.constructor.release(event);
48 }
49 }
50 };
55 -const executeDispatchesAndReleaseSimulated = function(e) {
56 - return executeDispatchesAndRelease(e, true);
57 -};
51 const executeDispatchesAndReleaseTopLevel = function(e) {
59 - return executeDispatchesAndRelease(e, false);
52 + return executeDispatchesAndRelease(e);
53 };
54
55 function isInteractive(tag) {
@@ -192,7 +185,6 @@ function extractEvents(
185
186 export function runEventsInBatch(
187 events: Array<ReactSyntheticEvent> | ReactSyntheticEvent | null,
195 - simulated: boolean,
188 ) {
189 if (events !== null) {
190 eventQueue = accumulateInto(eventQueue, events);
@@ -207,17 +199,7 @@ export function runEventsInBatch(
199 return;
200 }
201
210 - if (simulated) {
211 - forEachAccumulated(
212 - processingEventQueue,
213 - executeDispatchesAndReleaseSimulated,
214 - );
215 - } else {
216 - forEachAccumulated(
217 - processingEventQueue,
218 - executeDispatchesAndReleaseTopLevel,
219 - );
220 - }
202 + forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
203 invariant(
204 !eventQueue,
205 'processEventQueue(): Additional events were enqueued while processing ' +
@@ -239,5 +221,5 @@ export function runExtractedEventsInBatch(
221 nativeEvent,
222 nativeEventTarget,
223 );
242 - runEventsInBatch(events, false);
224 + runEventsInBatch(events);
225 }
packages/events/EventPluginUtils.js
+4 -10
@@ -60,11 +60,10 @@ if (__DEV__) {
60 /**
61 * Dispatch the event to the listener.
62 * @param {SyntheticEvent} event SyntheticEvent to handle
63 - * @param {boolean} simulated If the event is simulated (changes exn behavior)
63 * @param {function} listener Application-level callback
64 * @param {*} inst Internal component instance
65 */
67 -function executeDispatch(event, simulated, listener, inst) {
66 +function executeDispatch(event, listener, inst) {
67 const type = event.type || 'unknown-event';
68 event.currentTarget = getNodeFromInstance(inst);
69 invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
@@ -74,7 +73,7 @@ function executeDispatch(event, simulated, listener, inst) {
73 /**
74 * Standard/simple iteration through an event's collected dispatches.
75 */
77 -export function executeDispatchesInOrder(event, simulated) {
76 +export function executeDispatchesInOrder(event) {
77 const dispatchListeners = event._dispatchListeners;
78 const dispatchInstances = event._dispatchInstances;
79 if (__DEV__) {
@@ -86,15 +85,10 @@ export function executeDispatchesInOrder(event, simulated) {
85 break;
86 }
87 // Listeners and Instances are two parallel arrays that are always in sync.
89 - executeDispatch(
90 - event,
91 - simulated,
92 - dispatchListeners[i],
93 - dispatchInstances[i],
94 - );
88 + executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
89 }
90 } else if (dispatchListeners) {
97 - executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
91 + executeDispatch(event, dispatchListeners, dispatchInstances);
92 }
93 event._dispatchListeners = null;
94 event._dispatchInstances = null;
packages/events/__tests__/ResponderEventPlugin-test.internal.js
+1 -1
@@ -321,7 +321,7 @@ const run = function(config, hierarchyConfig, nativeEventConfig) {
321 // At this point the negotiation events have been dispatched as part of the
322 // extraction process, but not the side effectful events. Below, we dispatch
323 // side effectful events.
324 - EventPluginHub.runEventsInBatch(extractedEvents, true);
324 + EventPluginHub.runEventsInBatch(extractedEvents);
325
326 // Ensure that every event that declared an `order`, was actually dispatched.
327 expect('number of events dispatched:' + runData.dispatchCount).toBe(
packages/react-dom/src/events/ChangeEventPlugin.js
+1 -1
@@ -100,7 +100,7 @@ function manualDispatchChangeEvent(nativeEvent) {
100 }
101
102 function runEventInBatch(event) {
103 - EventPluginHub.runEventsInBatch(event, false);
103 + EventPluginHub.runEventsInBatch(event);
104 }
105
106 function getInstIfValueChanged(targetInst) {
packages/react-dom/src/test-utils/ReactTestUtils.js
+1 -1
@@ -435,7 +435,7 @@ function makeSimulator(eventType) {
435 // Normally extractEvent enqueues a state restore, but we'll just always
436 // do that since we we're by-passing it here.
437 enqueueStateRestore(domNode);
438 - runEventsInBatch(event, true);
438 + runEventsInBatch(event);
439 });
440 restoreStateIfNeeded();
441 };