MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / popHydrationState

Function popHydrationState

code/new-context-api/public/app.js:11575–11608  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

11573 }
11574
11575 function popHydrationState(fiber) {
11576 if (fiber !== hydrationParentFiber) {
11577 // We're deeper than the current hydration context, inside an inserted
11578 // tree.
11579 return false;
11580 }
11581 if (!isHydrating) {
11582 // If we're not currently hydrating but we're in a hydration context, then
11583 // we were an insertion and now need to pop up reenter hydration of our
11584 // siblings.
11585 popToNextHostParent(fiber);
11586 isHydrating = true;
11587 return false;
11588 }
11589
11590 var type = fiber.type;
11591
11592 // If we have any remaining hydratable nodes, we need to delete them now.
11593 // We only do this deeper than head and body since they tend to have random
11594 // other nodes in them. We also ignore components with pure text content in
11595 // side of them.
11596 // TODO: Better heuristic.
11597 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
11598 var nextInstance = nextHydratableInstance;
11599 while (nextInstance) {
11600 deleteHydratableInstance(fiber, nextInstance);
11601 nextInstance = getNextHydratableSibling(nextInstance);
11602 }
11603 }
11604
11605 popToNextHostParent(fiber);
11606 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
11607 return true;
11608 }
11609
11610 function resetHydrationState() {
11611 hydrationParentFiber = null;

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected