[Fiber] Use real event priority for hydration scheduling (#28765)
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
Josh Story committed
Apr 8, 2024 at 14:05 UTC
1f8327f834d923aa5a99cc0e81d2c9fc9d38c75d
1 file changed
+2
-5
packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js
+2
-5
@@ -38,7 +38,7 @@ import {isHigherEventPriority} from 'react-reconciler/src/ReactEventPriorities';
38
import {isRootDehydrated} from 'react-reconciler/src/ReactFiberShellHydration';
39
import {dispatchReplayedFormAction} from './plugins/FormActionEventPlugin';
40
import {
41
- getCurrentUpdatePriority,
41
+ resolveUpdatePriority,
42
runWithPriority as attemptHydrationAtPriority,
43
} from '../client/ReactDOMUpdatePriority';
44
@@ -333,10 +333,7 @@ function attemptExplicitHydrationTarget(
333
}
334
335
export function queueExplicitHydrationTarget(target: Node): void {
336
- // TODO: This will read the priority if it's dispatched by the React
337
- // event system but not native events. Should read window.event.type, like
338
- // we do for updates (getCurrentEventPriority).
339
- const updatePriority = getCurrentUpdatePriority();
336
+ const updatePriority = resolveUpdatePriority();
337
const queuedTarget: QueuedHydrationTarget = {
338
blockedOn: null,
339
target: target,