9
9
10
10
import type { Container } from './ReactDOMHostConfig' ;
11
11
import type { MutableSource , ReactNodeList } from 'shared/ReactTypes' ;
12
- import type { FiberRoot } from 'react-reconciler/src/ReactInternalTypes' ;
12
+ import type {
13
+ FiberRoot ,
14
+ TransitionTracingCallbacks ,
15
+ } from 'react-reconciler/src/ReactInternalTypes' ;
13
16
14
17
import { queueExplicitHydrationTarget } from '../events/ReactDOMEventReplaying' ;
15
18
@@ -25,6 +28,7 @@ export type CreateRootOptions = {
25
28
unstable_concurrentUpdatesByDefault ?: boolean ,
26
29
identifierPrefix ?: string ,
27
30
onRecoverableError ?: ( error : mixed ) => void ,
31
+ transitionCallbacks ? : TransitionTracingCallbacks ,
28
32
...
29
33
} ;
30
34
@@ -158,6 +162,8 @@ export function createRoot(
158
162
let concurrentUpdatesByDefaultOverride = false ;
159
163
let identifierPrefix = '' ;
160
164
let onRecoverableError = defaultOnRecoverableError ;
165
+ let transitionCallbacks = null ;
166
+
161
167
if ( options !== null && options !== undefined ) {
162
168
if ( __DEV__ ) {
163
169
if ( ( options : any ) . hydrate ) {
@@ -181,6 +187,9 @@ export function createRoot(
181
187
if ( options . onRecoverableError !== undefined ) {
182
188
onRecoverableError = options . onRecoverableError ;
183
189
}
190
+ if ( options . transitionCallbacks !== undefined ) {
191
+ transitionCallbacks = options . transitionCallbacks ;
192
+ }
184
193
}
185
194
186
195
const root = createContainer (
@@ -192,6 +201,7 @@ export function createRoot(
192
201
concurrentUpdatesByDefaultOverride ,
193
202
identifierPrefix ,
194
203
onRecoverableError ,
204
+ transitionCallbacks ,
195
205
) ;
196
206
markContainerAsRoot ( root . current , container ) ;
197
207
@@ -260,6 +270,8 @@ export function hydrateRoot(
260
270
concurrentUpdatesByDefaultOverride ,
261
271
identifierPrefix ,
262
272
onRecoverableError ,
273
+ // TODO(luna) Support hydration later
274
+ null ,
263
275
) ;
264
276
markContainerAsRoot ( root . current , container ) ;
265
277
// This can't be a comment node since hydration doesn't work on comment nodes anyway.
0 commit comments