@@ -361,36 +361,37 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
361361 return bailoutOnAlreadyFinishedWork ( current , workInProgress ) ;
362362 }
363363 const element = state . element ;
364- if ( current === null || current . child === null ) {
364+ if (
365+ ( current === null || current . child === null ) &&
366+ enterHydrationState ( workInProgress )
367+ ) {
365368 // If we don't have any current children this might be the first pass.
366369 // We always try to hydrate. If this isn't a hydration pass there won't
367370 // be any children to hydrate which is effectively the same thing as
368371 // not hydrating.
369- if ( enterHydrationState ( workInProgress ) ) {
370- // This is a bit of a hack. We track the host root as a placement to
371- // know that we're currently in a mounting state. That way isMounted
372- // works as expected. We must reset this before committing.
373- // TODO: Delete this when we delete isMounted and findDOMNode.
374- workInProgress . effectTag |= Placement ;
375-
376- // Ensure that children mount into this root without tracking
377- // side-effects. This ensures that we don't store Placement effects on
378- // nodes that will be hydrated.
379- workInProgress . child = mountChildFibersInPlace (
380- workInProgress ,
381- workInProgress . child ,
382- element ,
383- priorityLevel ,
384- ) ;
385- markChildAsProgressed ( current , workInProgress , priorityLevel ) ;
386- memoizeState ( workInProgress , state ) ;
387- return workInProgress . child ;
388- }
372+
373+ // This is a bit of a hack. We track the host root as a placement to
374+ // know that we're currently in a mounting state. That way isMounted
375+ // works as expected. We must reset this before committing.
376+ // TODO: Delete this when we delete isMounted and findDOMNode.
377+ workInProgress . effectTag |= Placement ;
378+
379+ // Ensure that children mount into this root without tracking
380+ // side-effects. This ensures that we don't store Placement effects on
381+ // nodes that will be hydrated.
382+ workInProgress . child = mountChildFibersInPlace (
383+ workInProgress ,
384+ workInProgress . child ,
385+ element ,
386+ priorityLevel ,
387+ ) ;
388+ markChildAsProgressed ( current , workInProgress , priorityLevel ) ;
389+ } else {
390+ // Otherwise reset hydration state in case we aborted and resumed another
391+ // root.
392+ resetHydrationState ( ) ;
393+ reconcileChildren ( current , workInProgress , element ) ;
389394 }
390- // Otherwise reset hydration state in case we aborted and resumed another
391- // root.
392- resetHydrationState ( ) ;
393- reconcileChildren ( current , workInProgress , element ) ;
394395 memoizeState ( workInProgress , state ) ;
395396 return workInProgress . child ;
396397 }
0 commit comments