MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / tryToClaimNextHydratableInstance

Function tryToClaimNextHydratableInstance

bundle.js:7637–7646  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

7635// parentInstance = returnFiber.stateNode.containerInfo;
7636// break;
7637case HostComponent$10:parentInstance=returnFiber.stateNode;break;default:return;}switch(fiber.tag){case HostComponent$10:var type=fiber.type;var props=fiber.pendingProps;didNotFindHydratableInstance(parentInstance,type,props);break;case HostText$8:var text=fiber.pendingProps;didNotFindHydratableTextInstance(parentInstance,text);break;}}}function canHydrate(fiber,nextInstance){switch(fiber.tag){case HostComponent$10:{var type=fiber.type;var props=fiber.pendingProps;return canHydrateInstance(nextInstance,type,props);}case HostText$8:{var text=fiber.pendingProps;return canHydrateTextInstance(nextInstance,text);}default:return false;}}function tryToClaimNextHydratableInstance(fiber){if(!isHydrating){return;}var nextInstance=nextHydratableInstance;if(!nextInstance){// Nothing to hydrate. Make it an insertion.
7638insertNonHydratedInstance(hydrationParentFiber,fiber);isHydrating=false;hydrationParentFiber=fiber;return;}if(!canHydrate(fiber,nextInstance)){// If we can't hydrate this instance let's try the next one.
7639// We use this as a heuristic. It's based on intuition and not data so it
7640// might be flawed or unnecessary.
7641nextInstance=getNextHydratableSibling(nextInstance);if(!nextInstance||!canHydrate(fiber,nextInstance)){// Nothing to hydrate. Make it an insertion.
7642insertNonHydratedInstance(hydrationParentFiber,fiber);isHydrating=false;hydrationParentFiber=fiber;return;}// We matched the next one, we'll now assume that the first one was
7643// superfluous and we'll delete it. Since we can't eagerly delete it
7644// we'll have to schedule a deletion. To do that, this node needs a dummy
7645// fiber associated with it.
7646deleteHydratableInstance(hydrationParentFiber,nextHydratableInstance);}fiber.stateNode=nextInstance;hydrationParentFiber=fiber;nextHydratableInstance=getFirstHydratableChild(nextInstance);}function prepareToHydrateHostInstance(fiber,rootContainerInstance,hostContext){var instance=fiber.stateNode;var updatePayload=hydrateInstance(instance,fiber.type,fiber.memoizedProps,rootContainerInstance,hostContext,fiber);// TODO: Type this specific to this type of component.
7647fiber.updateQueue=updatePayload;// If the update payload indicates that there is a change or if there
7648// is a new ref we mark this as an update.
7649if(updatePayload!==null){return true;}return false;}function prepareToHydrateHostTextInstance(fiber){var textInstance=fiber.stateNode;var shouldUpdate=hydrateTextInstance(textInstance,fiber.memoizedProps,fiber);return shouldUpdate;}function popToNextHostParent(fiber){var parent=fiber['return'];while(parent!==null&&parent.tag!==HostComponent$10&&parent.tag!==HostRoot$10){parent=parent['return'];}hydrationParentFiber=parent;}function popHydrationState(fiber){if(fiber!==hydrationParentFiber){// We're deeper than the current hydration context, inside an inserted

Callers 2

updateHostComponentFunction · 0.85
updateHostTextFunction · 0.85

Calls 3

canHydrateFunction · 0.85
deleteHydratableInstanceFunction · 0.85

Tested by

no test coverage detected