@@ -227,7 +227,11 @@ function warnNonHydratedInstance(
227227 }
228228}
229229
230- function tryHydrateInstance ( fiber : Fiber , nextInstance : any ) {
230+ function tryHydrateInstance (
231+ fiber : Fiber ,
232+ nextInstance : any ,
233+ hostContext : HostContext ,
234+ ) {
231235 // fiber is a HostComponent Fiber
232236 const instance = canHydrateInstance (
233237 nextInstance ,
@@ -237,6 +241,22 @@ function tryHydrateInstance(fiber: Fiber, nextInstance: any) {
237241 ) ;
238242 if ( instance !== null ) {
239243 fiber . stateNode = ( instance : Instance ) ;
244+
245+ if ( __DEV__ ) {
246+ if ( ! didSuspendOrErrorDEV ) {
247+ const differences = diffHydratedPropsForDevWarnings (
248+ instance ,
249+ fiber . type ,
250+ fiber . pendingProps ,
251+ hostContext ,
252+ ) ;
253+ if ( differences !== null ) {
254+ const diffNode = buildHydrationDiffNode ( fiber , 0 ) ;
255+ diffNode . serverProps = differences ;
256+ }
257+ }
258+ }
259+
240260 hydrationParentFiber = fiber ;
241261 nextHydratableInstance = getFirstHydratableChild ( instance ) ;
242262 rootOrSingletonContext = false ;
@@ -334,6 +354,22 @@ function claimHydratableSingleton(fiber: Fiber): void {
334354 currentHostContext ,
335355 false ,
336356 ) ) ;
357+
358+ if ( __DEV__ ) {
359+ if ( ! didSuspendOrErrorDEV ) {
360+ const differences = diffHydratedPropsForDevWarnings (
361+ instance ,
362+ fiber . type ,
363+ fiber . pendingProps ,
364+ currentHostContext ,
365+ ) ;
366+ if ( differences !== null ) {
367+ const diffNode = buildHydrationDiffNode ( fiber , 0 ) ;
368+ diffNode . serverProps = differences ;
369+ }
370+ }
371+ }
372+
337373 hydrationParentFiber = fiber ;
338374 rootOrSingletonContext = true ;
339375 nextHydratableInstance = getFirstHydratableChild ( instance ) ;
@@ -354,7 +390,10 @@ function tryToClaimNextHydratableInstance(fiber: Fiber): void {
354390 ) ;
355391
356392 const nextInstance = nextHydratableInstance ;
357- if ( ! nextInstance || ! tryHydrateInstance ( fiber , nextInstance ) ) {
393+ if (
394+ ! nextInstance ||
395+ ! tryHydrateInstance ( fiber , nextInstance , currentHostContext )
396+ ) {
358397 if ( shouldKeepWarning ) {
359398 warnNonHydratedInstance ( fiber , nextInstance ) ;
360399 }
@@ -433,22 +472,6 @@ function prepareToHydrateHostInstance(
433472 }
434473
435474 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-
452475 const didHydrate = hydrateInstance (
453476 instance ,
454477 fiber . type ,
0 commit comments