MCPcopy Index your code
hub / github.com/microsoft/SandDance / commitPlacement

Function commitPlacement

docs/external/js/react-dom.development.js:20420–20473  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

20418 }
20419
20420 function commitPlacement(finishedWork) {
20421
20422
20423 var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together.
20424
20425 var parent;
20426 var isContainer;
20427 var parentStateNode = parentFiber.stateNode;
20428
20429 switch (parentFiber.tag) {
20430 case HostComponent:
20431 parent = parentStateNode;
20432 isContainer = false;
20433 break;
20434
20435 case HostRoot:
20436 parent = parentStateNode.containerInfo;
20437 isContainer = true;
20438 break;
20439
20440 case HostPortal:
20441 parent = parentStateNode.containerInfo;
20442 isContainer = true;
20443 break;
20444
20445 case FundamentalComponent:
20446
20447 // eslint-disable-next-line-no-fallthrough
20448
20449 default:
20450 {
20451 {
20452 throw Error( "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." );
20453 }
20454 }
20455
20456 }
20457
20458 if (parentFiber.effectTag & ContentReset) {
20459 // Reset the text content of the parent before doing any insertions
20460 resetTextContent(parent); // Clear ContentReset from the effect tag
20461
20462 parentFiber.effectTag &= ~ContentReset;
20463 }
20464
20465 var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
20466 // children to find all the terminal nodes.
20467
20468 if (isContainer) {
20469 insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
20470 } else {
20471 insertOrAppendPlacementNode(finishedWork, before, parent);
20472 }
20473 }
20474
20475 function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
20476 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