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

Function reconcileChildFibers

bundle.js:7212–7227  ·  view source on GitHub ↗
(returnFiber,currentFirstChild,newChild,priority)

Source from the content-addressed store, hash-verified

7210// itself. They will be added to the side-effect list as we pass through the
7211// children and the parent.
7212function reconcileChildFibers(returnFiber,currentFirstChild,newChild,priority){// This function is not recursive.
7213// If the top level item is an array, we treat it as a set of children,
7214// not as a fragment. Nested arrays on the other hand will be treated as
7215// fragment nodes. Recursion happens at the normal flow.
7216// Handle object types
7217var isObject=(typeof newChild==='undefined'?'undefined':_typeof(newChild))==='object'&&newChild!==null;if(isObject){// Support only the subset of return types that Stack supports. Treat
7218// everything else as empty, but log a warning.
7219switch(newChild.$$typeof){case REACT_ELEMENT_TYPE:return placeSingleChild(reconcileSingleElement(returnFiber,currentFirstChild,newChild,priority));case REACT_COROUTINE_TYPE:return placeSingleChild(reconcileSingleCoroutine(returnFiber,currentFirstChild,newChild,priority));case REACT_YIELD_TYPE:return placeSingleChild(reconcileSingleYield(returnFiber,currentFirstChild,newChild,priority));case REACT_PORTAL_TYPE:return placeSingleChild(reconcileSinglePortal(returnFiber,currentFirstChild,newChild,priority));}}if(typeof newChild==='string'||typeof newChild==='number'){return placeSingleChild(reconcileSingleTextNode(returnFiber,currentFirstChild,''+newChild,priority));}if(isArray(newChild)){return reconcileChildrenArray(returnFiber,currentFirstChild,newChild,priority);}if(getIteratorFn(newChild)){return reconcileChildrenIterator(returnFiber,currentFirstChild,newChild,priority);}if(isObject){throwOnInvalidObjectType(returnFiber,newChild);}{if(typeof newChild==='function'){warnOnFunctionType();}}if(typeof newChild==='undefined'){// If the new child is undefined, and the return fiber is a composite
7220// component, throw an error. If Fiber return types are disabled,
7221// we already threw above.
7222switch(returnFiber.tag){case ClassComponent$7:{{var instance=returnFiber.stateNode;if(instance.render._isMockFunction){// We allow auto-mocks to proceed as if they're returning null.
7223break;}}}// Intentionally fall through to the next case, which handles both
7224// functions and classes
7225// eslint-disable-next-lined no-fallthrough
7226case FunctionalComponent$2:{var Component=returnFiber.type;invariant(false,'%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.',Component.displayName||Component.name||'Component');}}}// Remaining cases are all treated as empty.
7227return deleteRemainingChildren(returnFiber,currentFirstChild);}return reconcileChildFibers;}var reconcileChildFibers$1=ChildReconciler(true,true);var reconcileChildFibersInPlace$1=ChildReconciler(false,true);var mountChildFibersInPlace$1=ChildReconciler(false,false);var cloneChildFibers$1=function cloneChildFibers$1(current,workInProgress){!(current===null||workInProgress.child===current.child)?invariant(false,'Resuming work not yet implemented.'):void 0;if(workInProgress.child===null){return;}var currentChild=workInProgress.child;var newChild=createWorkInProgress$2(currentChild,currentChild.pendingWorkPriority);// TODO: Pass this as an argument, since it's easy to forget.
7228newChild.pendingProps=currentChild.pendingProps;workInProgress.child=newChild;newChild['return']=workInProgress;while(currentChild.sibling!==null){currentChild=currentChild.sibling;newChild=newChild.sibling=createWorkInProgress$2(currentChild,currentChild.pendingWorkPriority);newChild.pendingProps=currentChild.pendingProps;newChild['return']=workInProgress;}newChild.sibling=null;};var ReactChildFiber={reconcileChildFibers:reconcileChildFibers$1,reconcileChildFibersInPlace:reconcileChildFibersInPlace$1,mountChildFibersInPlace:mountChildFibersInPlace$1,cloneChildFibers:cloneChildFibers$1};var Update$1=ReactTypeOfSideEffect.Update;var AsyncUpdates$1=ReactTypeOfInternalContext.AsyncUpdates;var cacheContext$1=ReactFiberContext.cacheContext;var getMaskedContext$2=ReactFiberContext.getMaskedContext;var getUnmaskedContext$2=ReactFiberContext.getUnmaskedContext;var isContextConsumer$1=ReactFiberContext.isContextConsumer;var addUpdate$1=ReactFiberUpdateQueue.addUpdate;var addReplaceUpdate$1=ReactFiberUpdateQueue.addReplaceUpdate;var addForceUpdate$1=ReactFiberUpdateQueue.addForceUpdate;var beginUpdateQueue$2=ReactFiberUpdateQueue.beginUpdateQueue;var _require5=ReactFiberContext;var hasContextChanged$2=_require5.hasContextChanged;var isMounted$1=ReactFiberTreeReflection.isMounted;var fakeInternalInstance={};var isArray$1=Array.isArray;{var _require7$1=ReactDebugFiberPerf_1,startPhaseTimer$1=_require7$1.startPhaseTimer,stopPhaseTimer$1=_require7$1.stopPhaseTimer;var warning$25=require$$0;var warnOnInvalidCallback=function warnOnInvalidCallback(callback,callerName){warning$25(callback===null||typeof callback==='function','%s(...): Expected the last optional `callback` argument to be a '+'function. Instead received: %s.',callerName,callback);};// This is so gross but it's at least non-critical and can be removed if
7229// it causes problems. This is meant to give a nicer error message for
7230// ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,

Callers 2

updateCoroutineComponentFunction · 0.85

Calls 13

placeSingleChildFunction · 0.85
reconcileSingleElementFunction · 0.85
reconcileSingleCoroutineFunction · 0.85
reconcileSingleYieldFunction · 0.85
reconcileSinglePortalFunction · 0.85
reconcileSingleTextNodeFunction · 0.85
reconcileChildrenArrayFunction · 0.85
throwOnInvalidObjectTypeFunction · 0.85
warnOnFunctionTypeFunction · 0.85
deleteRemainingChildrenFunction · 0.85
getIteratorFnFunction · 0.70

Tested by

no test coverage detected