Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove scheduler priority from hydration #20957

Merged
merged 1 commit into from
Mar 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions packages/react-dom/src/events/ReactDOMEventReplaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import type {LanePriority} from 'react-reconciler/src/ReactFiberLane.old';

import {enableSelectiveHydration} from 'shared/ReactFeatureFlags';
import {
unstable_runWithPriority as runWithPriority,
unstable_scheduleCallback as scheduleCallback,
unstable_NormalPriority as NormalPriority,
unstable_getCurrentPriorityLevel as getCurrentPriorityLevel,
} from 'scheduler';
import {
getNearestMountedFiber,
Expand Down Expand Up @@ -111,7 +109,6 @@ const queuedPointerCaptures: Map<number, QueuedReplayableEvent> = new Map();
type QueuedHydrationTarget = {|
blockedOn: null | Container | SuspenseInstance,
target: Node,
priority: number,
lanePriority: LanePriority,
|};
const queuedExplicitHydrationTargets: Array<QueuedHydrationTarget> = [];
Expand Down Expand Up @@ -394,9 +391,7 @@ function attemptExplicitHydrationTarget(
// Increase its priority.
queuedTarget.blockedOn = instance;
attemptHydrationAtPriority(queuedTarget.lanePriority, () => {
runWithPriority(queuedTarget.priority, () => {
attemptHydrationAtCurrentPriority(nearestMounted);
});
attemptHydrationAtCurrentPriority(nearestMounted);
});

return;
Expand All @@ -417,17 +412,17 @@ function attemptExplicitHydrationTarget(

export function queueExplicitHydrationTarget(target: Node): void {
if (enableSelectiveHydration) {
const schedulerPriority = getCurrentPriorityLevel();
const updateLanePriority = getCurrentUpdatePriority();
const queuedTarget: QueuedHydrationTarget = {
blockedOn: null,
target: target,
priority: schedulerPriority,
lanePriority: updateLanePriority,
};
let i = 0;
for (; i < queuedExplicitHydrationTargets.length; i++) {
if (schedulerPriority <= queuedExplicitHydrationTargets[i].priority) {
if (
updateLanePriority <= queuedExplicitHydrationTargets[i].lanePriority
) {
break;
}
}
Expand Down