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

Function popHydrationState

code/controlled-uncontrolled/public/app.js:11538–11571  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

11536 }
11537
11538 function popHydrationState(fiber) {
11539 if (fiber !== hydrationParentFiber) {
11540 // We're deeper than the current hydration context, inside an inserted
11541 // tree.
11542 return false;
11543 }
11544 if (!isHydrating) {
11545 // If we're not currently hydrating but we're in a hydration context, then
11546 // we were an insertion and now need to pop up reenter hydration of our
11547 // siblings.
11548 popToNextHostParent(fiber);
11549 isHydrating = true;
11550 return false;
11551 }
11552
11553 var type = fiber.type;
11554
11555 // If we have any remaining hydratable nodes, we need to delete them now.
11556 // We only do this deeper than head and body since they tend to have random
11557 // other nodes in them. We also ignore components with pure text content in
11558 // side of them.
11559 // TODO: Better heuristic.
11560 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
11561 var nextInstance = nextHydratableInstance;
11562 while (nextInstance) {
11563 deleteHydratableInstance(fiber, nextInstance);
11564 nextInstance = getNextHydratableSibling(nextInstance);
11565 }
11566 }
11567
11568 popToNextHostParent(fiber);
11569 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
11570 return true;
11571 }
11572
11573 function resetHydrationState() {
11574 hydrationParentFiber = null;

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected