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

Function popHydrationState

code/styling/public/app.js:12214–12247  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

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

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected