Skip to content

Commit

Permalink
Separate the old and new codepaths
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Feb 8, 2021
1 parent 4f1edf0 commit 3fdc757
Showing 1 changed file with 35 additions and 27 deletions.
62 changes: 35 additions & 27 deletions packages/react-reconciler/src/ReactFiberWorkLoop.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,37 +469,45 @@ export function requestUpdateLane(fiber: Fiber): Lane {
const currentLanePriority = getCurrentUpdateLanePriority();
lane = findUpdateLane(currentLanePriority, currentEventWipLanes);
} else {
let eventPriority = DefaultEvent;
if (enableNativeEventPriorityInference) {
eventPriority = getCurrentEventPriority();
}
switch (eventPriority) {
case DiscreteEvent: {
lane = findUpdateLane(InputDiscreteLanePriority, currentEventWipLanes);
break;
}
case ContinuousEvent: {
lane = findUpdateLane(
InputContinuousLanePriority,
currentEventWipLanes,
);
break;
}
default: {
if (__DEV__) {
console.error(
'Invalid event priority returned from getCurrentEventPriority: %s.',
eventPriority,
const eventPriority = getCurrentEventPriority();
switch (eventPriority) {
case DiscreteEvent: {
lane = findUpdateLane(
InputDiscreteLanePriority,
currentEventWipLanes,
);
break;
}
case ContinuousEvent: {
lane = findUpdateLane(
InputContinuousLanePriority,
currentEventWipLanes,
);
break;
}
default: {
if (__DEV__) {
console.error(
'Invalid event priority returned from getCurrentEventPriority: %s.',
eventPriority,
);
}
}
// eslint-disable-next-line no-fallthrough
case DefaultEvent: {
// TODO: move this case into the ReactDOM host config.
const schedulerLanePriority = schedulerPriorityToLanePriority(
schedulerPriority,
);
lane = findUpdateLane(schedulerLanePriority, currentEventWipLanes);
}
}
// eslint-disable-next-line no-fallthrough
case DefaultEvent: {
const schedulerLanePriority = schedulerPriorityToLanePriority(
schedulerPriority,
);
lane = findUpdateLane(schedulerLanePriority, currentEventWipLanes);
}
} else {
const schedulerLanePriority = schedulerPriorityToLanePriority(
schedulerPriority,
);
lane = findUpdateLane(schedulerLanePriority, currentEventWipLanes);
}
}

Expand Down

0 comments on commit 3fdc757

Please sign in to comment.