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

Function commitLifeCycles

code/new-context-api/public/app.js:10619–10697  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)

Source from the content-addressed store, hash-verified

10617 }
10618
10619 function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
10620 switch (finishedWork.tag) {
10621 case ClassComponent:
10622 {
10623 var _instance = finishedWork.stateNode;
10624 if (finishedWork.effectTag & Update) {
10625 if (current === null) {
10626 startPhaseTimer(finishedWork, 'componentDidMount');
10627 _instance.props = finishedWork.memoizedProps;
10628 _instance.state = finishedWork.memoizedState;
10629 _instance.componentDidMount();
10630 stopPhaseTimer();
10631 } else {
10632 var prevProps = current.memoizedProps;
10633 var prevState = current.memoizedState;
10634 startPhaseTimer(finishedWork, 'componentDidUpdate');
10635 _instance.props = finishedWork.memoizedProps;
10636 _instance.state = finishedWork.memoizedState;
10637 _instance.componentDidUpdate(prevProps, prevState);
10638 stopPhaseTimer();
10639 }
10640 }
10641 var updateQueue = finishedWork.updateQueue;
10642 if (updateQueue !== null) {
10643 commitCallbacks(updateQueue, _instance);
10644 }
10645 return;
10646 }
10647 case HostRoot:
10648 {
10649 var _updateQueue = finishedWork.updateQueue;
10650 if (_updateQueue !== null) {
10651 var _instance2 = null;
10652 if (finishedWork.child !== null) {
10653 switch (finishedWork.child.tag) {
10654 case HostComponent:
10655 _instance2 = getPublicInstance(finishedWork.child.stateNode);
10656 break;
10657 case ClassComponent:
10658 _instance2 = finishedWork.child.stateNode;
10659 break;
10660 }
10661 }
10662 commitCallbacks(_updateQueue, _instance2);
10663 }
10664 return;
10665 }
10666 case HostComponent:
10667 {
10668 var _instance3 = finishedWork.stateNode;
10669
10670 // Renderers may schedule work to be done after host components are mounted
10671 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
10672 // These effects should only be committed when components are first mounted,
10673 // aka when there is no current/alternate.
10674 if (current === null && finishedWork.effectTag & Update) {
10675 var type = finishedWork.type;
10676 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