MCPcopy Create free account
hub / github.com/reactjs/react-rails / commitPlacement

Function commitPlacement

lib/assets/react-source/development/react.js:23980–24033  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

23978 }
23979
23980 function commitPlacement(finishedWork) {
23981
23982
23983 var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together.
23984
23985 var parent;
23986 var isContainer;
23987 var parentStateNode = parentFiber.stateNode;
23988
23989 switch (parentFiber.tag) {
23990 case HostComponent:
23991 parent = parentStateNode;
23992 isContainer = false;
23993 break;
23994
23995 case HostRoot:
23996 parent = parentStateNode.containerInfo;
23997 isContainer = true;
23998 break;
23999
24000 case HostPortal:
24001 parent = parentStateNode.containerInfo;
24002 isContainer = true;
24003 break;
24004
24005 case FundamentalComponent:
24006
24007 // eslint-disable-next-line-no-fallthrough
24008
24009 default:
24010 {
24011 {
24012 throw Error( "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." );
24013 }
24014 }
24015
24016 }
24017
24018 if (parentFiber.effectTag & ContentReset) {
24019 // Reset the text content of the parent before doing any insertions
24020 resetTextContent(parent); // Clear ContentReset from the effect tag
24021
24022 parentFiber.effectTag &= ~ContentReset;
24023 }
24024
24025 var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
24026 // children to find all the terminal nodes.
24027
24028 if (isContainer) {
24029 insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
24030 } else {
24031 insertOrAppendPlacementNode(finishedWork, before, parent);
24032 }
24033 }
24034
24035 function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
24036 var tag = node.tag;

Callers 1

commitMutationEffectsFunction · 0.85

Calls 5

getHostParentFiberFunction · 0.85
resetTextContentFunction · 0.85
getHostSiblingFunction · 0.85

Tested by

no test coverage detected