@@ -227,7 +227,11 @@ function warnNonHydratedInstance(
227
227
}
228
228
}
229
229
230
- function tryHydrateInstance ( fiber : Fiber , nextInstance : any ) {
230
+ function tryHydrateInstance (
231
+ fiber : Fiber ,
232
+ nextInstance : any ,
233
+ hostContext : HostContext ,
234
+ ) {
231
235
// fiber is a HostComponent Fiber
232
236
const instance = canHydrateInstance (
233
237
nextInstance ,
@@ -237,6 +241,23 @@ function tryHydrateInstance(fiber: Fiber, nextInstance: any) {
237
241
) ;
238
242
if ( instance !== null ) {
239
243
fiber . stateNode = ( instance : Instance ) ;
244
+
245
+ if ( __DEV__ ) {
246
+ const shouldWarnIfMismatchDev = ! didSuspendOrErrorDEV ;
247
+ if ( shouldWarnIfMismatchDev ) {
248
+ const differences = diffHydratedPropsForDevWarnings (
249
+ instance ,
250
+ fiber . type ,
251
+ fiber . pendingProps ,
252
+ hostContext ,
253
+ ) ;
254
+ if ( differences !== null ) {
255
+ const diffNode = buildHydrationDiffNode ( fiber , 0 ) ;
256
+ diffNode . serverProps = differences ;
257
+ }
258
+ }
259
+ }
260
+
240
261
hydrationParentFiber = fiber ;
241
262
nextHydratableInstance = getFirstHydratableChild ( instance ) ;
242
263
rootOrSingletonContext = false ;
@@ -354,7 +375,10 @@ function tryToClaimNextHydratableInstance(fiber: Fiber): void {
354
375
) ;
355
376
356
377
const nextInstance = nextHydratableInstance ;
357
- if ( ! nextInstance || ! tryHydrateInstance ( fiber , nextInstance ) ) {
378
+ if (
379
+ ! nextInstance ||
380
+ ! tryHydrateInstance ( fiber , nextInstance , currentHostContext )
381
+ ) {
358
382
if ( shouldKeepWarning ) {
359
383
warnNonHydratedInstance ( fiber , nextInstance ) ;
360
384
}
@@ -433,22 +457,6 @@ function prepareToHydrateHostInstance(
433
457
}
434
458
435
459
const instance : Instance = fiber . stateNode ;
436
- if ( __DEV__ ) {
437
- const shouldWarnIfMismatchDev = ! didSuspendOrErrorDEV ;
438
- if ( shouldWarnIfMismatchDev ) {
439
- const differences = diffHydratedPropsForDevWarnings (
440
- instance ,
441
- fiber . type ,
442
- fiber . memoizedProps ,
443
- hostContext ,
444
- ) ;
445
- if ( differences !== null ) {
446
- const diffNode = buildHydrationDiffNode ( fiber , 0 ) ;
447
- diffNode . serverProps = differences ;
448
- }
449
- }
450
- }
451
-
452
460
const didHydrate = hydrateInstance (
453
461
instance ,
454
462
fiber . type ,
0 commit comments