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

Function commitLifeCycles

code/dependency-injection/public/app.js:11351–11429  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)

Source from the content-addressed store, hash-verified

11349 }
11350
11351 function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
11352 switch (finishedWork.tag) {
11353 case ClassComponent:
11354 {
11355 var _instance = finishedWork.stateNode;
11356 if (finishedWork.effectTag & Update) {
11357 if (current === null) {
11358 startPhaseTimer(finishedWork, 'componentDidMount');
11359 _instance.props = finishedWork.memoizedProps;
11360 _instance.state = finishedWork.memoizedState;
11361 _instance.componentDidMount();
11362 stopPhaseTimer();
11363 } else {
11364 var prevProps = current.memoizedProps;
11365 var prevState = current.memoizedState;
11366 startPhaseTimer(finishedWork, 'componentDidUpdate');
11367 _instance.props = finishedWork.memoizedProps;
11368 _instance.state = finishedWork.memoizedState;
11369 _instance.componentDidUpdate(prevProps, prevState);
11370 stopPhaseTimer();
11371 }
11372 }
11373 var updateQueue = finishedWork.updateQueue;
11374 if (updateQueue !== null) {
11375 commitCallbacks(updateQueue, _instance);
11376 }
11377 return;
11378 }
11379 case HostRoot:
11380 {
11381 var _updateQueue = finishedWork.updateQueue;
11382 if (_updateQueue !== null) {
11383 var _instance2 = null;
11384 if (finishedWork.child !== null) {
11385 switch (finishedWork.child.tag) {
11386 case HostComponent:
11387 _instance2 = getPublicInstance(finishedWork.child.stateNode);
11388 break;
11389 case ClassComponent:
11390 _instance2 = finishedWork.child.stateNode;
11391 break;
11392 }
11393 }
11394 commitCallbacks(_updateQueue, _instance2);
11395 }
11396 return;
11397 }
11398 case HostComponent:
11399 {
11400 var _instance3 = finishedWork.stateNode;
11401
11402 // Renderers may schedule work to be done after host components are mounted
11403 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
11404 // These effects should only be committed when components are first mounted,
11405 // aka when there is no current/alternate.
11406 if (current === null && finishedWork.effectTag & Update) {
11407 var type = finishedWork.type;
11408 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