MCPcopy Create free account
hub / github.com/reactjs/react-rails / popHydrationState

Function popHydrationState

lib/assets/react-source/development/react.js:20379–20420  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

20377 }
20378
20379 function popHydrationState(fiber) {
20380
20381 if (fiber !== hydrationParentFiber) {
20382 // We're deeper than the current hydration context, inside an inserted
20383 // tree.
20384 return false;
20385 }
20386
20387 if (!isHydrating) {
20388 // If we're not currently hydrating but we're in a hydration context, then
20389 // we were an insertion and now need to pop up reenter hydration of our
20390 // siblings.
20391 popToNextHostParent(fiber);
20392 isHydrating = true;
20393 return false;
20394 }
20395
20396 var type = fiber.type; // If we have any remaining hydratable nodes, we need to delete them now.
20397 // We only do this deeper than head and body since they tend to have random
20398 // other nodes in them. We also ignore components with pure text content in
20399 // side of them.
20400 // TODO: Better heuristic.
20401
20402 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
20403 var nextInstance = nextHydratableInstance;
20404
20405 while (nextInstance) {
20406 deleteHydratableInstance(fiber, nextInstance);
20407 nextInstance = getNextHydratableSibling(nextInstance);
20408 }
20409 }
20410
20411 popToNextHostParent(fiber);
20412
20413 if (fiber.tag === SuspenseComponent) {
20414 nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
20415 } else {
20416 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
20417 }
20418
20419 return true;
20420 }
20421
20422 function resetHydrationState() {
20423

Callers 1

completeWorkFunction · 0.85

Calls 5

popToNextHostParentFunction · 0.85
shouldSetTextContentFunction · 0.85
deleteHydratableInstanceFunction · 0.85
getNextHydratableSiblingFunction · 0.85

Tested by

no test coverage detected