@@ -14,10 +14,7 @@ import type {EventSystemFlags} from './EventSystemFlags';
14
14
import type { FiberRoot } from 'react-reconciler/src/ReactInternalTypes' ;
15
15
import type { EventPriority } from 'react-reconciler/src/ReactEventPriorities' ;
16
16
17
- import {
18
- enableSelectiveHydration ,
19
- enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
20
- } from 'shared/ReactFeatureFlags' ;
17
+ import { enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay } from 'shared/ReactFeatureFlags' ;
21
18
import {
22
19
unstable_scheduleCallback as scheduleCallback ,
23
20
unstable_NormalPriority as NormalPriority ,
@@ -204,27 +201,25 @@ export function queueDiscreteEvent(
204
201
nativeEvent ,
205
202
) ;
206
203
queuedDiscreteEvents . push ( queuedEvent ) ;
207
- if ( enableSelectiveHydration ) {
208
- if ( queuedDiscreteEvents . length === 1 ) {
209
- // If this was the first discrete event, we might be able to
210
- // synchronously unblock it so that preventDefault still works.
211
- while ( queuedEvent . blockedOn !== null ) {
212
- const fiber = getInstanceFromNode ( queuedEvent . blockedOn ) ;
213
- if ( fiber === null ) {
214
- break ;
215
- }
216
- attemptSynchronousHydration ( fiber ) ;
217
- if ( queuedEvent . blockedOn === null ) {
218
- // We got unblocked by hydration. Let's try again.
219
- replayUnblockedEvents ( ) ;
220
- // If we're reblocked, on an inner boundary, we might need
221
- // to attempt hydrating that one.
222
- continue ;
223
- } else {
224
- // We're still blocked from hydration, we have to give up
225
- // and replay later.
226
- break ;
227
- }
204
+ if ( queuedDiscreteEvents . length === 1 ) {
205
+ // If this was the first discrete event, we might be able to
206
+ // synchronously unblock it so that preventDefault still works.
207
+ while ( queuedEvent . blockedOn !== null ) {
208
+ const fiber = getInstanceFromNode ( queuedEvent . blockedOn ) ;
209
+ if ( fiber === null ) {
210
+ break ;
211
+ }
212
+ attemptSynchronousHydration ( fiber ) ;
213
+ if ( queuedEvent . blockedOn === null ) {
214
+ // We got unblocked by hydration. Let's try again.
215
+ replayUnblockedEvents ( ) ;
216
+ // If we're reblocked, on an inner boundary, we might need
217
+ // to attempt hydrating that one.
218
+ continue ;
219
+ } else {
220
+ // We're still blocked from hydration, we have to give up
221
+ // and replay later.
222
+ break ;
228
223
}
229
224
}
230
225
}
@@ -428,33 +423,31 @@ function attemptExplicitHydrationTarget(
428
423
}
429
424
430
425
export function queueExplicitHydrationTarget ( target : Node ) : void {
431
- if ( enableSelectiveHydration ) {
432
- // TODO: This will read the priority if it's dispatched by the React
433
- // event system but not native events. Should read window.event.type, like
434
- // we do for updates (getCurrentEventPriority).
435
- const updatePriority = getCurrentUpdatePriority ( ) ;
436
- const queuedTarget : QueuedHydrationTarget = {
437
- blockedOn : null ,
438
- target : target ,
439
- priority : updatePriority ,
440
- } ;
441
- let i = 0 ;
442
- for ( ; i < queuedExplicitHydrationTargets . length ; i ++ ) {
443
- // Stop once we hit the first target with lower priority than
444
- if (
445
- ! isHigherEventPriority (
446
- updatePriority ,
447
- queuedExplicitHydrationTargets [ i ] . priority ,
448
- )
449
- ) {
450
- break ;
451
- }
452
- }
453
- queuedExplicitHydrationTargets . splice ( i , 0 , queuedTarget ) ;
454
- if ( i === 0 ) {
455
- attemptExplicitHydrationTarget ( queuedTarget ) ;
426
+ // TODO: This will read the priority if it's dispatched by the React
427
+ // event system but not native events. Should read window.event.type, like
428
+ // we do for updates (getCurrentEventPriority).
429
+ const updatePriority = getCurrentUpdatePriority ( ) ;
430
+ const queuedTarget : QueuedHydrationTarget = {
431
+ blockedOn : null ,
432
+ target : target ,
433
+ priority : updatePriority ,
434
+ } ;
435
+ let i = 0 ;
436
+ for ( ; i < queuedExplicitHydrationTargets . length ; i ++ ) {
437
+ // Stop once we hit the first target with lower priority than
438
+ if (
439
+ ! isHigherEventPriority (
440
+ updatePriority ,
441
+ queuedExplicitHydrationTargets [ i ] . priority ,
442
+ )
443
+ ) {
444
+ break ;
456
445
}
457
446
}
447
+ queuedExplicitHydrationTargets . splice ( i , 0 , queuedTarget ) ;
448
+ if ( i === 0 ) {
449
+ attemptExplicitHydrationTarget ( queuedTarget ) ;
450
+ }
458
451
}
459
452
460
453
function attemptReplayContinuousQueuedEvent (
0 commit comments