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

Function popHydrationState

code/redux/public/app.js:12465–12498  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

12463 }
12464
12465 function popHydrationState(fiber) {
12466 if (fiber !== hydrationParentFiber) {
12467 // We're deeper than the current hydration context, inside an inserted
12468 // tree.
12469 return false;
12470 }
12471 if (!isHydrating) {
12472 // If we're not currently hydrating but we're in a hydration context, then
12473 // we were an insertion and now need to pop up reenter hydration of our
12474 // siblings.
12475 popToNextHostParent(fiber);
12476 isHydrating = true;
12477 return false;
12478 }
12479
12480 var type = fiber.type;
12481
12482 // If we have any remaining hydratable nodes, we need to delete them now.
12483 // We only do this deeper than head and body since they tend to have random
12484 // other nodes in them. We also ignore components with pure text content in
12485 // side of them.
12486 // TODO: Better heuristic.
12487 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
12488 var nextInstance = nextHydratableInstance;
12489 while (nextInstance) {
12490 deleteHydratableInstance(fiber, nextInstance);
12491 nextInstance = getNextHydratableSibling(nextInstance);
12492 }
12493 }
12494
12495 popToNextHostParent(fiber);
12496 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
12497 return true;
12498 }
12499
12500 function resetHydrationState() {
12501 hydrationParentFiber = null;

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected