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

Function commitLifeCycles

code/redux/public/app.js:11509–11587  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)

Source from the content-addressed store, hash-verified

11507 }
11508
11509 function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
11510 switch (finishedWork.tag) {
11511 case ClassComponent:
11512 {
11513 var _instance = finishedWork.stateNode;
11514 if (finishedWork.effectTag & Update) {
11515 if (current === null) {
11516 startPhaseTimer(finishedWork, 'componentDidMount');
11517 _instance.props = finishedWork.memoizedProps;
11518 _instance.state = finishedWork.memoizedState;
11519 _instance.componentDidMount();
11520 stopPhaseTimer();
11521 } else {
11522 var prevProps = current.memoizedProps;
11523 var prevState = current.memoizedState;
11524 startPhaseTimer(finishedWork, 'componentDidUpdate');
11525 _instance.props = finishedWork.memoizedProps;
11526 _instance.state = finishedWork.memoizedState;
11527 _instance.componentDidUpdate(prevProps, prevState);
11528 stopPhaseTimer();
11529 }
11530 }
11531 var updateQueue = finishedWork.updateQueue;
11532 if (updateQueue !== null) {
11533 commitCallbacks(updateQueue, _instance);
11534 }
11535 return;
11536 }
11537 case HostRoot:
11538 {
11539 var _updateQueue = finishedWork.updateQueue;
11540 if (_updateQueue !== null) {
11541 var _instance2 = null;
11542 if (finishedWork.child !== null) {
11543 switch (finishedWork.child.tag) {
11544 case HostComponent:
11545 _instance2 = getPublicInstance(finishedWork.child.stateNode);
11546 break;
11547 case ClassComponent:
11548 _instance2 = finishedWork.child.stateNode;
11549 break;
11550 }
11551 }
11552 commitCallbacks(_updateQueue, _instance2);
11553 }
11554 return;
11555 }
11556 case HostComponent:
11557 {
11558 var _instance3 = finishedWork.stateNode;
11559
11560 // Renderers may schedule work to be done after host components are mounted
11561 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
11562 // These effects should only be committed when components are first mounted,
11563 // aka when there is no current/alternate.
11564 if (current === null && finishedWork.effectTag & Update) {
11565 var type = finishedWork.type;
11566 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