@samitouri / QOS-React-2 / commits / 9cfba0f6ec

Clean up discrete event replaying (#26558)

We no longer replay and discrete events. I might re-add a form of this but it'll look a little different.

Sebastian Markbåge committed Apr 5, 2023 at 19:38 UTC 9cfba0f6ecc15a342ef184552742c5db6c7f2d3e
2 files changed +1 -29
packages/react-dom-bindings/src/events/ReactDOMEventListener.js
+1 -1
@@ -57,7 +57,7 @@ import {isRootDehydrated} from 'react-reconciler/src/ReactFiberShellHydration';
57 const {ReactCurrentBatchConfig} = ReactSharedInternals;
58
59 // TODO: can we stop exporting these?
60 -export let _enabled: boolean = true;
60 +let _enabled: boolean = true;
61
62 // This is exported in FB builds for use by legacy FB layer infra.
63 // We'd like to remove this but it's not clear if this is safe.
packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js
-28
@@ -60,11 +60,6 @@ type QueuedReplayableEvent = {
60
61 let hasScheduledReplayAttempt = false;
62
63 -// The queue of discrete events to be replayed.
64 -const queuedDiscreteEvents: Array<QueuedReplayableEvent> = [];
65 -
66 -// Indicates if any continuous event targets are non-null for early bailout.
67 -const hasAnyQueuedContinuousEvents: boolean = false;
63 // The last of each continuous event type. We only need to replay the last one
64 // if the last target was dehydrated.
65 let queuedFocus: null | QueuedReplayableEvent = null;
@@ -82,14 +77,6 @@ type QueuedHydrationTarget = {
77 };
78 const queuedExplicitHydrationTargets: Array<QueuedHydrationTarget> = [];
79
85 -export function hasQueuedDiscreteEvents(): boolean {
86 - return queuedDiscreteEvents.length > 0;
87 -}
88 -
89 -export function hasQueuedContinuousEvents(): boolean {
90 - return hasAnyQueuedContinuousEvents;
91 -}
92 -
80 const discreteReplayableEvents: Array<DOMEventName> = [
81 'mousedown',
82 'mouseup',
@@ -446,21 +433,6 @@ function scheduleCallbackIfUnblocked(
433 export function retryIfBlockedOn(
434 unblocked: Container | SuspenseInstance,
435 ): void {
449 - // Mark anything that was blocked on this as no longer blocked
450 - // and eligible for a replay.
451 - if (queuedDiscreteEvents.length > 0) {
452 - scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked);
453 - // This is a exponential search for each boundary that commits. I think it's
454 - // worth it because we expect very few discrete events to queue up and once
455 - // we are actually fully unblocked it will be fast to replay them.
456 - for (let i = 1; i < queuedDiscreteEvents.length; i++) {
457 - const queuedEvent = queuedDiscreteEvents[i];
458 - if (queuedEvent.blockedOn === unblocked) {
459 - queuedEvent.blockedOn = null;
460 - }
461 - }
462 - }
463 -
436 if (queuedFocus !== null) {
437 scheduleCallbackIfUnblocked(queuedFocus, unblocked);
438 }