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

Function popHydrationState

code/third-party/public/app.js:11447–11480  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

11445 }
11446
11447 function popHydrationState(fiber) {
11448 if (fiber !== hydrationParentFiber) {
11449 // We're deeper than the current hydration context, inside an inserted
11450 // tree.
11451 return false;
11452 }
11453 if (!isHydrating) {
11454 // If we're not currently hydrating but we're in a hydration context, then
11455 // we were an insertion and now need to pop up reenter hydration of our
11456 // siblings.
11457 popToNextHostParent(fiber);
11458 isHydrating = true;
11459 return false;
11460 }
11461
11462 var type = fiber.type;
11463
11464 // If we have any remaining hydratable nodes, we need to delete them now.
11465 // We only do this deeper than head and body since they tend to have random
11466 // other nodes in them. We also ignore components with pure text content in
11467 // side of them.
11468 // TODO: Better heuristic.
11469 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
11470 var nextInstance = nextHydratableInstance;
11471 while (nextInstance) {
11472 deleteHydratableInstance(fiber, nextInstance);
11473 nextInstance = getNextHydratableSibling(nextInstance);
11474 }
11475 }
11476
11477 popToNextHostParent(fiber);
11478 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
11479 return true;
11480 }
11481
11482 function resetHydrationState() {
11483 hydrationParentFiber = null;

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected