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

Function popHydrationState

code/dependency-injection/public/app.js:12307–12340  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

12305 }
12306
12307 function popHydrationState(fiber) {
12308 if (fiber !== hydrationParentFiber) {
12309 // We're deeper than the current hydration context, inside an inserted
12310 // tree.
12311 return false;
12312 }
12313 if (!isHydrating) {
12314 // If we're not currently hydrating but we're in a hydration context, then
12315 // we were an insertion and now need to pop up reenter hydration of our
12316 // siblings.
12317 popToNextHostParent(fiber);
12318 isHydrating = true;
12319 return false;
12320 }
12321
12322 var type = fiber.type;
12323
12324 // If we have any remaining hydratable nodes, we need to delete them now.
12325 // We only do this deeper than head and body since they tend to have random
12326 // other nodes in them. We also ignore components with pure text content in
12327 // side of them.
12328 // TODO: Better heuristic.
12329 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
12330 var nextInstance = nextHydratableInstance;
12331 while (nextInstance) {
12332 deleteHydratableInstance(fiber, nextInstance);
12333 nextInstance = getNextHydratableSibling(nextInstance);
12334 }
12335 }
12336
12337 popToNextHostParent(fiber);
12338 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
12339 return true;
12340 }
12341
12342 function resetHydrationState() {
12343 hydrationParentFiber = null;

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected