MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / commitLifeCycles

Function commitLifeCycles

code/composition/public/app.js:11396–11474  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)

Source from the content-addressed store, hash-verified

11394 }
11395
11396 function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
11397 switch (finishedWork.tag) {
11398 case ClassComponent:
11399 {
11400 var _instance = finishedWork.stateNode;
11401 if (finishedWork.effectTag & Update) {
11402 if (current === null) {
11403 startPhaseTimer(finishedWork, 'componentDidMount');
11404 _instance.props = finishedWork.memoizedProps;
11405 _instance.state = finishedWork.memoizedState;
11406 _instance.componentDidMount();
11407 stopPhaseTimer();
11408 } else {
11409 var prevProps = current.memoizedProps;
11410 var prevState = current.memoizedState;
11411 startPhaseTimer(finishedWork, 'componentDidUpdate');
11412 _instance.props = finishedWork.memoizedProps;
11413 _instance.state = finishedWork.memoizedState;
11414 _instance.componentDidUpdate(prevProps, prevState);
11415 stopPhaseTimer();
11416 }
11417 }
11418 var updateQueue = finishedWork.updateQueue;
11419 if (updateQueue !== null) {
11420 commitCallbacks(updateQueue, _instance);
11421 }
11422 return;
11423 }
11424 case HostRoot:
11425 {
11426 var _updateQueue = finishedWork.updateQueue;
11427 if (_updateQueue !== null) {
11428 var _instance2 = null;
11429 if (finishedWork.child !== null) {
11430 switch (finishedWork.child.tag) {
11431 case HostComponent:
11432 _instance2 = getPublicInstance(finishedWork.child.stateNode);
11433 break;
11434 case ClassComponent:
11435 _instance2 = finishedWork.child.stateNode;
11436 break;
11437 }
11438 }
11439 commitCallbacks(_updateQueue, _instance2);
11440 }
11441 return;
11442 }
11443 case HostComponent:
11444 {
11445 var _instance3 = finishedWork.stateNode;
11446
11447 // Renderers may schedule work to be done after host components are mounted
11448 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
11449 // These effects should only be committed when components are first mounted,
11450 // aka when there is no current/alternate.
11451 if (current === null && finishedWork.effectTag & Update) {
11452 var type = finishedWork.type;
11453 var props = finishedWork.memoizedProps;

Callers 1

commitAllLifeCyclesFunction · 0.70

Calls 5

startPhaseTimerFunction · 0.70
stopPhaseTimerFunction · 0.70
commitCallbacksFunction · 0.70
invariantFunction · 0.70
componentDidMountMethod · 0.45

Tested by

no test coverage detected