(config)
| 7620 | push$2(contextFiberStackCursor,fiber,fiber);push$2(contextStackCursor,nextContext,fiber);}function popHostContext(fiber){// Do not pop unless this Fiber provided the current context. |
| 7621 | // pushHostContext() only pushes Fibers that provide unique contexts. |
| 7622 | if(contextFiberStackCursor.current!==fiber){return;}pop$2(contextStackCursor,fiber);pop$2(contextFiberStackCursor,fiber);}function resetHostContainer(){contextStackCursor.current=NO_CONTEXT;rootInstanceStackCursor.current=NO_CONTEXT;}return{getHostContext:getHostContext,getRootHostContainer:getRootHostContainer,popHostContainer:popHostContainer,popHostContext:popHostContext,pushHostContainer:pushHostContainer,pushHostContext:pushHostContext,resetHostContainer:resetHostContainer};};var HostComponent$10=ReactTypeOfWork.HostComponent;var HostText$8=ReactTypeOfWork.HostText;var HostRoot$10=ReactTypeOfWork.HostRoot;var Deletion$2=ReactTypeOfSideEffect.Deletion;var Placement$6=ReactTypeOfSideEffect.Placement;var createFiberFromHostInstanceForDeletion$1=ReactFiber.createFiberFromHostInstanceForDeletion;var ReactFiberHydrationContext=function ReactFiberHydrationContext(config){var shouldSetTextContent=config.shouldSetTextContent,canHydrateInstance=config.canHydrateInstance,canHydrateTextInstance=config.canHydrateTextInstance,getNextHydratableSibling=config.getNextHydratableSibling,getFirstHydratableChild=config.getFirstHydratableChild,hydrateInstance=config.hydrateInstance,hydrateTextInstance=config.hydrateTextInstance,didNotHydrateInstance=config.didNotHydrateInstance,didNotFindHydratableInstance=config.didNotFindHydratableInstance,didNotFindHydratableTextInstance=config.didNotFindHydratableTextInstance;// If this doesn't have hydration mode. |
| 7623 | if(!(canHydrateInstance&&canHydrateTextInstance&&getNextHydratableSibling&&getFirstHydratableChild&&hydrateInstance&&hydrateTextInstance&&didNotHydrateInstance&&didNotFindHydratableInstance&&didNotFindHydratableTextInstance)){return{enterHydrationState:function enterHydrationState(){return false;},resetHydrationState:function resetHydrationState(){},tryToClaimNextHydratableInstance:function tryToClaimNextHydratableInstance(){},prepareToHydrateHostInstance:function prepareToHydrateHostInstance(){invariant(false,'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');},prepareToHydrateHostTextInstance:function prepareToHydrateHostTextInstance(){invariant(false,'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');},popHydrationState:function popHydrationState(fiber){return false;}};}// The deepest Fiber on the stack involved in a hydration context. |
| 7624 | // This may have been an insertion or a hydration. |
| 7625 | var hydrationParentFiber=null;var nextHydratableInstance=null;var isHydrating=false;function enterHydrationState(fiber){var parentInstance=fiber.stateNode.containerInfo;nextHydratableInstance=getFirstHydratableChild(parentInstance);hydrationParentFiber=fiber;isHydrating=true;return true;}function deleteHydratableInstance(returnFiber,instance){{switch(returnFiber.tag){case HostRoot$10:didNotHydrateInstance(returnFiber.stateNode.containerInfo,instance);break;case HostComponent$10:didNotHydrateInstance(returnFiber.stateNode,instance);break;}}var childToDelete=createFiberFromHostInstanceForDeletion$1();childToDelete.stateNode=instance;childToDelete['return']=returnFiber;childToDelete.effectTag=Deletion$2;// This might seem like it belongs on progressedFirstDeletion. However, |
| 7626 | // these children are not part of the reconciliation list of children. |
| 7627 | // Even if we abort and rereconcile the children, that will try to hydrate |
| 7628 | // again and the nodes are still in the host tree so these will be |
| 7629 | // recreated. |
| 7630 | if(returnFiber.lastEffect!==null){returnFiber.lastEffect.nextEffect=childToDelete;returnFiber.lastEffect=childToDelete;}else{returnFiber.firstEffect=returnFiber.lastEffect=childToDelete;}}function insertNonHydratedInstance(returnFiber,fiber){fiber.effectTag|=Placement$6;{var parentInstance;switch(returnFiber.tag){// TODO: Currently we don't warn for insertions into the root because |
| 7631 | // we always insert into the root in the non-hydrating case. We just |
| 7632 | // delete the existing content. Reenable this once we have a better |
| 7633 | // strategy for determining if we're hydrating or not. |
| 7634 | // case HostRoot: |
| 7635 | // parentInstance = returnFiber.stateNode.containerInfo; |
| 7636 | // break; |
| 7637 | case 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. |
| 7638 | insertNonHydratedInstance(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. |
| 7641 | nextInstance=getNextHydratableSibling(nextInstance);if(!nextInstance||!canHydrate(fiber,nextInstance)){// Nothing to hydrate. Make it an insertion. |
| 7642 | insertNonHydratedInstance(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. |
| 7646 | deleteHydratableInstance(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. |
| 7647 | fiber.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. |
| 7649 | if(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 |
| 7650 | // tree. |
| 7651 | return false;}if(!isHydrating){// If we're not currently hydrating but we're in a hydration context, then |
| 7652 | // we were an insertion and now need to pop up reenter hydration of our |
| 7653 | // siblings. |
| 7654 | popToNextHostParent(fiber);isHydrating=true;return false;}var type=fiber.type;// If we have any remaining hydratable nodes, we need to delete them now. |
| 7655 | // We only do this deeper than head and body since they tend to have random |
| 7656 | // other nodes in them. We also ignore components with pure text content in |
| 7657 | // side of them. |
| 7658 | // TODO: Better heuristic. |
| 7659 | if(fiber.tag!==HostComponent$10||type!=='head'&&type!=='body'&&!shouldSetTextContent(type,fiber.memoizedProps)){var nextInstance=nextHydratableInstance;while(nextInstance){deleteHydratableInstance(fiber,nextInstance);nextInstance=getNextHydratableSibling(nextInstance);}}popToNextHostParent(fiber);nextHydratableInstance=hydrationParentFiber?getNextHydratableSibling(fiber.stateNode):null;return true;}function resetHydrationState(){hydrationParentFiber=null;nextHydratableInstance=null;isHydrating=false;}return{enterHydrationState:enterHydrationState,resetHydrationState:resetHydrationState,tryToClaimNextHydratableInstance:tryToClaimNextHydratableInstance,prepareToHydrateHostInstance:prepareToHydrateHostInstance,prepareToHydrateHostTextInstance:prepareToHydrateHostTextInstance,popHydrationState:popHydrationState};};/** |
| 7660 | * Copyright (c) 2013-present, Facebook, Inc. |
| 7661 | * |
| 7662 | * This source code is licensed under the MIT license found in the |
no test coverage detected