@@ -220,7 +220,11 @@ function warnNonHydratedInstance(
220220 }
221221}
222222
223- function tryHydrateInstance ( fiber : Fiber , nextInstance : any ) {
223+ function tryHydrateInstance (
224+ fiber : Fiber ,
225+ nextInstance : any ,
226+ hostContext : HostContext ,
227+ ) {
224228 // fiber is a HostComponent Fiber
225229 const instance = canHydrateInstance (
226230 nextInstance ,
@@ -230,6 +234,22 @@ function tryHydrateInstance(fiber: Fiber, nextInstance: any) {
230234 ) ;
231235 if ( instance !== null ) {
232236 fiber . stateNode = ( instance : Instance ) ;
237+
238+ if ( __DEV__ ) {
239+ if ( ! didSuspendOrErrorDEV ) {
240+ const differences = diffHydratedPropsForDevWarnings (
241+ instance ,
242+ fiber . type ,
243+ fiber . pendingProps ,
244+ hostContext ,
245+ ) ;
246+ if ( differences !== null ) {
247+ const diffNode = buildHydrationDiffNode ( fiber , 0 ) ;
248+ diffNode . serverProps = differences ;
249+ }
250+ }
251+ }
252+
233253 hydrationParentFiber = fiber ;
234254 nextHydratableInstance = getFirstHydratableChild ( instance ) ;
235255 rootOrSingletonContext = false ;
@@ -327,6 +347,22 @@ function claimHydratableSingleton(fiber: Fiber): void {
327347 currentHostContext ,
328348 false ,
329349 ) ) ;
350+
351+ if ( __DEV__ ) {
352+ if ( ! didSuspendOrErrorDEV ) {
353+ const differences = diffHydratedPropsForDevWarnings (
354+ instance ,
355+ fiber . type ,
356+ fiber . pendingProps ,
357+ currentHostContext ,
358+ ) ;
359+ if ( differences !== null ) {
360+ const diffNode = buildHydrationDiffNode ( fiber , 0 ) ;
361+ diffNode . serverProps = differences ;
362+ }
363+ }
364+ }
365+
330366 hydrationParentFiber = fiber ;
331367 rootOrSingletonContext = true ;
332368 nextHydratableInstance = getFirstHydratableChild ( instance ) ;
@@ -347,7 +383,10 @@ function tryToClaimNextHydratableInstance(fiber: Fiber): void {
347383 ) ;
348384
349385 const nextInstance = nextHydratableInstance ;
350- if ( ! nextInstance || ! tryHydrateInstance ( fiber , nextInstance ) ) {
386+ if (
387+ ! nextInstance ||
388+ ! tryHydrateInstance ( fiber , nextInstance , currentHostContext )
389+ ) {
351390 if ( shouldKeepWarning ) {
352391 warnNonHydratedInstance ( fiber , nextInstance ) ;
353392 }
@@ -426,22 +465,6 @@ function prepareToHydrateHostInstance(
426465 }
427466
428467 const instance : Instance = fiber . stateNode ;
429- if ( __DEV__ ) {
430- const shouldWarnIfMismatchDev = ! didSuspendOrErrorDEV ;
431- if ( shouldWarnIfMismatchDev ) {
432- const differences = diffHydratedPropsForDevWarnings (
433- instance ,
434- fiber . type ,
435- fiber . memoizedProps ,
436- hostContext ,
437- ) ;
438- if ( differences !== null ) {
439- const diffNode = buildHydrationDiffNode ( fiber , 0 ) ;
440- diffNode . serverProps = differences ;
441- }
442- }
443- }
444-
445468 const didHydrate = hydrateInstance (
446469 instance ,
447470 fiber . type ,
0 commit comments