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

Function popHydrationState

code/one-direction-data-flow/public/app.js:12087–12120  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

12085 }
12086
12087 function popHydrationState(fiber) {
12088 if (fiber !== hydrationParentFiber) {
12089 // We're deeper than the current hydration context, inside an inserted
12090 // tree.
12091 return false;
12092 }
12093 if (!isHydrating) {
12094 // If we're not currently hydrating but we're in a hydration context, then
12095 // we were an insertion and now need to pop up reenter hydration of our
12096 // siblings.
12097 popToNextHostParent(fiber);
12098 isHydrating = true;
12099 return false;
12100 }
12101
12102 var type = fiber.type;
12103
12104 // If we have any remaining hydratable nodes, we need to delete them now.
12105 // We only do this deeper than head and body since they tend to have random
12106 // other nodes in them. We also ignore components with pure text content in
12107 // side of them.
12108 // TODO: Better heuristic.
12109 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
12110 var nextInstance = nextHydratableInstance;
12111 while (nextInstance) {
12112 deleteHydratableInstance(fiber, nextInstance);
12113 nextInstance = getNextHydratableSibling(nextInstance);
12114 }
12115 }
12116
12117 popToNextHostParent(fiber);
12118 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
12119 return true;
12120 }
12121
12122 function resetHydrationState() {
12123 hydrationParentFiber = null;

Callers 1

completeWorkFunction · 0.70

Calls 2

popToNextHostParentFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected