@@ -448,44 +448,27 @@ export function requestUpdateLane(fiber: Fiber): Lane {
448
448
// To do that, we're replacing it with an update lane priority.
449
449
const schedulerPriority = getCurrentPriorityLevel ( ) ;
450
450
451
- // The old behavior was using the priority level of the Scheduler.
452
- // This couples React to the Scheduler internals, so we're replacing it
453
- // with the currentUpdateLanePriority above. As an example of how this
454
- // could be problematic, if we're not inside `Scheduler.runWithPriority`,
455
- // then we'll get the priority of the current running Scheduler task,
456
- // which is probably not what we want.
451
+ // Find the correct lane based on priorities. Ideally, this would just be
452
+ // the update lane priority, but for now we're also checking for discrete
453
+ // updates and falling back to the scheduler priority.
457
454
let lane ;
458
455
if (
459
456
// TODO: Temporary. We're removing the concept of discrete updates.
460
457
( executionContext & DiscreteEventContext ) !== NoContext &&
461
458
schedulerPriority === UserBlockingSchedulerPriority
462
459
) {
463
460
lane = findUpdateLane ( InputDiscreteLanePriority , currentEventWipLanes ) ;
461
+ } else if (
462
+ decoupleUpdatePriorityFromScheduler &&
463
+ getCurrentUpdateLanePriority ( ) !== NoLanePriority
464
+ ) {
465
+ const currentLanePriority = getCurrentUpdateLanePriority ( ) ;
466
+ lane = findUpdateLane ( currentLanePriority , currentEventWipLanes ) ;
464
467
} else {
465
468
const schedulerLanePriority = schedulerPriorityToLanePriority (
466
469
schedulerPriority ,
467
470
) ;
468
471
469
- if ( decoupleUpdatePriorityFromScheduler ) {
470
- // In the new strategy, we will track the current update lane priority
471
- // inside React and use that priority to select a lane for this update.
472
- // For now, we're just logging when they're different so we can assess.
473
- const currentUpdateLanePriority = getCurrentUpdateLanePriority ( ) ;
474
-
475
- if (
476
- schedulerLanePriority !== currentUpdateLanePriority &&
477
- currentUpdateLanePriority !== NoLanePriority
478
- ) {
479
- if ( __DEV__ ) {
480
- console . error (
481
- 'Expected current scheduler lane priority %s to match current update lane priority %s' ,
482
- schedulerLanePriority ,
483
- currentUpdateLanePriority ,
484
- ) ;
485
- }
486
- }
487
- }
488
-
489
472
lane = findUpdateLane ( schedulerLanePriority , currentEventWipLanes ) ;
490
473
}
491
474
0 commit comments