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

Function commitLifeCycles

code/higher-order-components/public/app.js:11252–11330  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)

Source from the content-addressed store, hash-verified

11250 }
11251
11252 function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
11253 switch (finishedWork.tag) {
11254 case ClassComponent:
11255 {
11256 var _instance = finishedWork.stateNode;
11257 if (finishedWork.effectTag & Update) {
11258 if (current === null) {
11259 startPhaseTimer(finishedWork, 'componentDidMount');
11260 _instance.props = finishedWork.memoizedProps;
11261 _instance.state = finishedWork.memoizedState;
11262 _instance.componentDidMount();
11263 stopPhaseTimer();
11264 } else {
11265 var prevProps = current.memoizedProps;
11266 var prevState = current.memoizedState;
11267 startPhaseTimer(finishedWork, 'componentDidUpdate');
11268 _instance.props = finishedWork.memoizedProps;
11269 _instance.state = finishedWork.memoizedState;
11270 _instance.componentDidUpdate(prevProps, prevState);
11271 stopPhaseTimer();
11272 }
11273 }
11274 var updateQueue = finishedWork.updateQueue;
11275 if (updateQueue !== null) {
11276 commitCallbacks(updateQueue, _instance);
11277 }
11278 return;
11279 }
11280 case HostRoot:
11281 {
11282 var _updateQueue = finishedWork.updateQueue;
11283 if (_updateQueue !== null) {
11284 var _instance2 = null;
11285 if (finishedWork.child !== null) {
11286 switch (finishedWork.child.tag) {
11287 case HostComponent:
11288 _instance2 = getPublicInstance(finishedWork.child.stateNode);
11289 break;
11290 case ClassComponent:
11291 _instance2 = finishedWork.child.stateNode;
11292 break;
11293 }
11294 }
11295 commitCallbacks(_updateQueue, _instance2);
11296 }
11297 return;
11298 }
11299 case HostComponent:
11300 {
11301 var _instance3 = finishedWork.stateNode;
11302
11303 // Renderers may schedule work to be done after host components are mounted
11304 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
11305 // These effects should only be committed when components are first mounted,
11306 // aka when there is no current/alternate.
11307 if (current === null && finishedWork.effectTag & Update) {
11308 var type = finishedWork.type;
11309 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