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

Function placeChild

code/higher-order-components/public/app.js:8970–8992  ·  view source on GitHub ↗
(newFiber, lastPlacedIndex, newIndex)

Source from the content-addressed store, hash-verified

8968 }
8969
8970 function placeChild(newFiber, lastPlacedIndex, newIndex) {
8971 newFiber.index = newIndex;
8972 if (!shouldTrackSideEffects) {
8973 // Noop.
8974 return lastPlacedIndex;
8975 }
8976 var current = newFiber.alternate;
8977 if (current !== null) {
8978 var oldIndex = current.index;
8979 if (oldIndex < lastPlacedIndex) {
8980 // This is a move.
8981 newFiber.effectTag = Placement;
8982 return lastPlacedIndex;
8983 } else {
8984 // This item can stay in place.
8985 return oldIndex;
8986 }
8987 } else {
8988 // This is an insertion.
8989 newFiber.effectTag = Placement;
8990 return lastPlacedIndex;
8991 }
8992 }
8993
8994 function placeSingleChild(newFiber) {
8995 // This is simpler for the single child case. We only need to do a

Callers 2

reconcileChildrenArrayFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected