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

Function commitLifeCycles

code/styling/public/app.js:11258–11336  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)

Source from the content-addressed store, hash-verified

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