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

Function updateSlot

bundle.js:7114–7123  ·  view source on GitHub ↗
(returnFiber,oldFiber,newChild,priority)

Source from the content-addressed store, hash-verified

7112// we can continue to replace it without aborting even if it is not a text
7113// node.
7114var created=createFiberFromText$1(''+newChild,returnFiber.internalContextTag,priority);created['return']=returnFiber;return created;}if((typeof newChild==='undefined'?'undefined':_typeof(newChild))==='object'&&newChild!==null){switch(newChild.$$typeof){case REACT_ELEMENT_TYPE:{var _created=createFiberFromElement$1(newChild,returnFiber.internalContextTag,priority);_created.ref=coerceRef(null,newChild);_created['return']=returnFiber;return _created;}case REACT_COROUTINE_TYPE:{var _created2=createFiberFromCoroutine$1(newChild,returnFiber.internalContextTag,priority);_created2['return']=returnFiber;return _created2;}case REACT_YIELD_TYPE:{var _created3=createFiberFromYield$1(newChild,returnFiber.internalContextTag,priority);_created3.type=newChild.value;_created3['return']=returnFiber;return _created3;}case REACT_PORTAL_TYPE:{var _created4=createFiberFromPortal$1(newChild,returnFiber.internalContextTag,priority);_created4['return']=returnFiber;return _created4;}}if(isArray(newChild)||getIteratorFn(newChild)){var _created5=createFiberFromFragment$1(newChild,returnFiber.internalContextTag,priority);_created5['return']=returnFiber;return _created5;}throwOnInvalidObjectType(returnFiber,newChild);}{if(typeof newChild==='function'){warnOnFunctionType();}}return null;}function updateSlot(returnFiber,oldFiber,newChild,priority){// Update the fiber if the keys match, otherwise return null.
7115var key=oldFiber!==null?oldFiber.key:null;if(typeof newChild==='string'||typeof newChild==='number'){// Text nodes doesn't have keys. If the previous node is implicitly keyed
7116// we can continue to replace it without aborting even if it is not a text
7117// node.
7118if(key!==null){return null;}return updateTextNode(returnFiber,oldFiber,''+newChild,priority);}if((typeof newChild==='undefined'?'undefined':_typeof(newChild))==='object'&&newChild!==null){switch(newChild.$$typeof){case REACT_ELEMENT_TYPE:{if(newChild.key===key){return updateElement(returnFiber,oldFiber,newChild,priority);}else{return null;}}case REACT_COROUTINE_TYPE:{if(newChild.key===key){return updateCoroutine(returnFiber,oldFiber,newChild,priority);}else{return null;}}case REACT_YIELD_TYPE:{// Yields doesn't have keys. If the previous node is implicitly keyed
7119// we can continue to replace it without aborting even if it is not a
7120// yield.
7121if(key===null){return updateYield(returnFiber,oldFiber,newChild,priority);}else{return null;}}case REACT_PORTAL_TYPE:{if(newChild.key===key){return updatePortal(returnFiber,oldFiber,newChild,priority);}else{return null;}}}if(isArray(newChild)||getIteratorFn(newChild)){// Fragments doesn't have keys so if the previous key is implicit we can
7122// update it.
7123if(key!==null){return null;}return updateFragment(returnFiber,oldFiber,newChild,priority);}throwOnInvalidObjectType(returnFiber,newChild);}{if(typeof newChild==='function'){warnOnFunctionType();}}return null;}function updateFromMap(existingChildren,returnFiber,newIdx,newChild,priority){if(typeof newChild==='string'||typeof newChild==='number'){// Text nodes doesn't have keys, so we neither have to check the old nor
7124// new node for the key. If both are text nodes, they match.
7125var matchedFiber=existingChildren.get(newIdx)||null;return updateTextNode(returnFiber,matchedFiber,''+newChild,priority);}if((typeof newChild==='undefined'?'undefined':_typeof(newChild))==='object'&&newChild!==null){switch(newChild.$$typeof){case REACT_ELEMENT_TYPE:{var _matchedFiber=existingChildren.get(newChild.key===null?newIdx:newChild.key)||null;return updateElement(returnFiber,_matchedFiber,newChild,priority);}case REACT_COROUTINE_TYPE:{var _matchedFiber2=existingChildren.get(newChild.key===null?newIdx:newChild.key)||null;return updateCoroutine(returnFiber,_matchedFiber2,newChild,priority);}case REACT_YIELD_TYPE:{// Yields doesn't have keys, so we neither have to check the old nor
7126// new node for the key. If both are yields, they match.

Callers 2

reconcileChildrenArrayFunction · 0.85

Calls 9

updateTextNodeFunction · 0.85
updateElementFunction · 0.85
updateCoroutineFunction · 0.85
updateYieldFunction · 0.85
updatePortalFunction · 0.85
updateFragmentFunction · 0.85
throwOnInvalidObjectTypeFunction · 0.85
warnOnFunctionTypeFunction · 0.85
getIteratorFnFunction · 0.70

Tested by

no test coverage detected