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

Function tryToClaimNextHydratableInstance

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

Source from the content-addressed store, hash-verified

12125 }
12126
12127 function tryToClaimNextHydratableInstance(fiber) {
12128 if (!isHydrating) {
12129 return;
12130 }
12131 var nextInstance = nextHydratableInstance;
12132 if (!nextInstance) {
12133 // Nothing to hydrate. Make it an insertion.
12134 insertNonHydratedInstance(hydrationParentFiber, fiber);
12135 isHydrating = false;
12136 hydrationParentFiber = fiber;
12137 return;
12138 }
12139 if (!tryHydrate(fiber, nextInstance)) {
12140 // If we can't hydrate this instance let's try the next one.
12141 // We use this as a heuristic. It's based on intuition and not data so it
12142 // might be flawed or unnecessary.
12143 nextInstance = getNextHydratableSibling(nextInstance);
12144 if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
12145 // Nothing to hydrate. Make it an insertion.
12146 insertNonHydratedInstance(hydrationParentFiber, fiber);
12147 isHydrating = false;
12148 hydrationParentFiber = fiber;
12149 return;
12150 }
12151 // We matched the next one, we'll now assume that the first one was
12152 // superfluous and we'll delete it. Since we can't eagerly delete it
12153 // we'll have to schedule a deletion. To do that, this node needs a dummy
12154 // fiber associated with it.
12155 deleteHydratableInstance(hydrationParentFiber, nextHydratableInstance);
12156 }
12157 hydrationParentFiber = fiber;
12158 nextHydratableInstance = getFirstHydratableChild(nextInstance);
12159 }
12160
12161 function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
12162 var instance = fiber.stateNode;

Callers 2

updateHostComponentFunction · 0.70
updateHostTextFunction · 0.70

Calls 3

tryHydrateFunction · 0.70
deleteHydratableInstanceFunction · 0.70

Tested by

no test coverage detected