Skip to content

Commit 9cfba0f

Browse files
authored
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.
1 parent 790ebc9 commit 9cfba0f

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import {isRootDehydrated} from 'react-reconciler/src/ReactFiberShellHydration';
5757
const {ReactCurrentBatchConfig} = ReactSharedInternals;
5858

5959
// TODO: can we stop exporting these?
60-
export let _enabled: boolean = true;
60+
let _enabled: boolean = true;
6161

6262
// This is exported in FB builds for use by legacy FB layer infra.
6363
// We'd like to remove this but it's not clear if this is safe.

packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ type QueuedReplayableEvent = {
6060

6161
let hasScheduledReplayAttempt = false;
6262

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;
6863
// The last of each continuous event type. We only need to replay the last one
6964
// if the last target was dehydrated.
7065
let queuedFocus: null | QueuedReplayableEvent = null;
@@ -82,14 +77,6 @@ type QueuedHydrationTarget = {
8277
};
8378
const queuedExplicitHydrationTargets: Array<QueuedHydrationTarget> = [];
8479

85-
export function hasQueuedDiscreteEvents(): boolean {
86-
return queuedDiscreteEvents.length > 0;
87-
}
88-
89-
export function hasQueuedContinuousEvents(): boolean {
90-
return hasAnyQueuedContinuousEvents;
91-
}
92-
9380
const discreteReplayableEvents: Array<DOMEventName> = [
9481
'mousedown',
9582
'mouseup',
@@ -446,21 +433,6 @@ function scheduleCallbackIfUnblocked(
446433
export function retryIfBlockedOn(
447434
unblocked: Container | SuspenseInstance,
448435
): 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-
464436
if (queuedFocus !== null) {
465437
scheduleCallbackIfUnblocked(queuedFocus, unblocked);
466438
}

0 commit comments

Comments
 (0)