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

Function popHydrationState

code/higher-order-components/public/app.js:12208–12241  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

12206 }
12207
12208 function popHydrationState(fiber) {
12209 if (fiber !== hydrationParentFiber) {
12210 // We're deeper than the current hydration context, inside an inserted
12211 // tree.
12212 return false;
12213 }
12214 if (!isHydrating) {
12215 // If we're not currently hydrating but we're in a hydration context, then
12216 // we were an insertion and now need to pop up reenter hydration of our
12217 // siblings.
12218 popToNextHostParent(fiber);
12219 isHydrating = true;
12220 return false;
12221 }
12222
12223 var type = fiber.type;
12224
12225 // If we have any remaining hydratable nodes, we need to delete them now.
12226 // We only do this deeper than head and body since they tend to have random
12227 // other nodes in them. We also ignore components with pure text content in
12228 // side of them.
12229 // TODO: Better heuristic.
12230 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
12231 var nextInstance = nextHydratableInstance;
12232 while (nextInstance) {
12233 deleteHydratableInstance(fiber, nextInstance);
12234 nextInstance = getNextHydratableSibling(nextInstance);
12235 }
12236 }
12237
12238 popToNextHostParent(fiber);
12239 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
12240 return true;
12241 }
12242
12243 function resetHydrationState() {
12244 hydrationParentFiber = null;

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected