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

Function commitLifeCycles

code/controlled-uncontrolled/public/app.js:10582–10660  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)

Source from the content-addressed store, hash-verified

10580 }
10581
10582 function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
10583 switch (finishedWork.tag) {
10584 case ClassComponent:
10585 {
10586 var _instance = finishedWork.stateNode;
10587 if (finishedWork.effectTag & Update) {
10588 if (current === null) {
10589 startPhaseTimer(finishedWork, 'componentDidMount');
10590 _instance.props = finishedWork.memoizedProps;
10591 _instance.state = finishedWork.memoizedState;
10592 _instance.componentDidMount();
10593 stopPhaseTimer();
10594 } else {
10595 var prevProps = current.memoizedProps;
10596 var prevState = current.memoizedState;
10597 startPhaseTimer(finishedWork, 'componentDidUpdate');
10598 _instance.props = finishedWork.memoizedProps;
10599 _instance.state = finishedWork.memoizedState;
10600 _instance.componentDidUpdate(prevProps, prevState);
10601 stopPhaseTimer();
10602 }
10603 }
10604 var updateQueue = finishedWork.updateQueue;
10605 if (updateQueue !== null) {
10606 commitCallbacks(updateQueue, _instance);
10607 }
10608 return;
10609 }
10610 case HostRoot:
10611 {
10612 var _updateQueue = finishedWork.updateQueue;
10613 if (_updateQueue !== null) {
10614 var _instance2 = null;
10615 if (finishedWork.child !== null) {
10616 switch (finishedWork.child.tag) {
10617 case HostComponent:
10618 _instance2 = getPublicInstance(finishedWork.child.stateNode);
10619 break;
10620 case ClassComponent:
10621 _instance2 = finishedWork.child.stateNode;
10622 break;
10623 }
10624 }
10625 commitCallbacks(_updateQueue, _instance2);
10626 }
10627 return;
10628 }
10629 case HostComponent:
10630 {
10631 var _instance3 = finishedWork.stateNode;
10632
10633 // Renderers may schedule work to be done after host components are mounted
10634 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
10635 // These effects should only be committed when components are first mounted,
10636 // aka when there is no current/alternate.
10637 if (current === null && finishedWork.effectTag & Update) {
10638 var type = finishedWork.type;
10639 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