Skip to content

Commit

Permalink
[Fiber] Use real event priority for hydration scheduling (#28765)
Browse files Browse the repository at this point in the history
Stacked on #28751 

Historically explicit hydration scheduling used the reconciler's update
priority to schedule the hydration. There was a lingering todo to switch
to using event priority in the absence of an explicit update priority.
This change updates the hydration priority by referring to the event
priority if no update priority is set
  • Loading branch information
gnoff authored and rickhanlonii committed Apr 11, 2024
1 parent 2f0908c commit d90d4e8
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {isHigherEventPriority} from 'react-reconciler/src/ReactEventPriorities';
import {isRootDehydrated} from 'react-reconciler/src/ReactFiberShellHydration';
import {dispatchReplayedFormAction} from './plugins/FormActionEventPlugin';
import {
getCurrentUpdatePriority,
resolveUpdatePriority,
runWithPriority as attemptHydrationAtPriority,
} from '../client/ReactDOMUpdatePriority';

Expand Down Expand Up @@ -333,10 +333,7 @@ function attemptExplicitHydrationTarget(
}

export function queueExplicitHydrationTarget(target: Node): void {
// TODO: This will read the priority if it's dispatched by the React
// event system but not native events. Should read window.event.type, like
// we do for updates (getCurrentEventPriority).
const updatePriority = getCurrentUpdatePriority();
const updatePriority = resolveUpdatePriority();
const queuedTarget: QueuedHydrationTarget = {
blockedOn: null,
target: target,
Expand Down

0 comments on commit d90d4e8

Please sign in to comment.