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

Function popHydrationState

code/communication/public/app.js:12249–12282  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

12247 }
12248
12249 function popHydrationState(fiber) {
12250 if (fiber !== hydrationParentFiber) {
12251 // We're deeper than the current hydration context, inside an inserted
12252 // tree.
12253 return false;
12254 }
12255 if (!isHydrating) {
12256 // If we're not currently hydrating but we're in a hydration context, then
12257 // we were an insertion and now need to pop up reenter hydration of our
12258 // siblings.
12259 popToNextHostParent(fiber);
12260 isHydrating = true;
12261 return false;
12262 }
12263
12264 var type = fiber.type;
12265
12266 // If we have any remaining hydratable nodes, we need to delete them now.
12267 // We only do this deeper than head and body since they tend to have random
12268 // other nodes in them. We also ignore components with pure text content in
12269 // side of them.
12270 // TODO: Better heuristic.
12271 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
12272 var nextInstance = nextHydratableInstance;
12273 while (nextInstance) {
12274 deleteHydratableInstance(fiber, nextInstance);
12275 nextInstance = getNextHydratableSibling(nextInstance);
12276 }
12277 }
12278
12279 popToNextHostParent(fiber);
12280 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
12281 return true;
12282 }
12283
12284 function resetHydrationState() {
12285 hydrationParentFiber = null;

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected