add transistion callbacks to hydrateRoot (#24937)
This PR adds transition callbacks to hydrateRoot.
Luna Ruan committed
Jul 18, 2022 at 13:22 UTC
6daf600609e7699106673b37b507097bc2ea5139
1 file changed
+6
-2
packages/react-dom/src/client/ReactDOMRoot.js
+6
-2
@@ -40,6 +40,7 @@ export type HydrateRootOptions = {
40
// Options for all roots
41
unstable_strictMode?: boolean,
42
unstable_concurrentUpdatesByDefault?: boolean,
43
+ unstable_transitionCallbacks?: TransitionTracingCallbacks,
44
identifierPrefix?: string,
45
onRecoverableError?: (error: mixed) => void,
46
...
@@ -282,6 +283,7 @@ export function hydrateRoot(
283
let concurrentUpdatesByDefaultOverride = false;
284
let identifierPrefix = '';
285
let onRecoverableError = defaultOnRecoverableError;
286
+ let transitionCallbacks = null;
287
if (options !== null && options !== undefined) {
288
if (options.unstable_strictMode === true) {
289
isStrictMode = true;
@@ -298,6 +300,9 @@ export function hydrateRoot(
300
if (options.onRecoverableError !== undefined) {
301
onRecoverableError = options.onRecoverableError;
302
}
303
+ if (options.unstable_transitionCallbacks !== undefined) {
304
+ transitionCallbacks = options.unstable_transitionCallbacks;
305
+ }
306
}
307
308
const root = createHydrationContainer(
@@ -310,8 +315,7 @@ export function hydrateRoot(
315
concurrentUpdatesByDefaultOverride,
316
identifierPrefix,
317
onRecoverableError,
313
- // TODO(luna) Support hydration later
314
- null,
318
+ transitionCallbacks,
319
);
320
markContainerAsRoot(root.current, container);
321
// This can't be a comment node since hydration doesn't work on comment nodes anyway.