From d90d4e8837408e4f1b757cbf44864de4761f3d64 Mon Sep 17 00:00:00 2001 From: Josh Story Date: Mon, 8 Apr 2024 14:05:17 -0700 Subject: [PATCH] [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 --- .../src/events/ReactDOMEventReplaying.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js b/packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js index fc5e59eb839e5..52cfb07aaa2d5 100644 --- a/packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js +++ b/packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js @@ -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'; @@ -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,