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

Function commitLifeCycles

code/communication/public/app.js:11293–11371  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, currentTime, committedExpirationTime)

Source from the content-addressed store, hash-verified

11291 }
11292
11293 function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
11294 switch (finishedWork.tag) {
11295 case ClassComponent:
11296 {
11297 var _instance = finishedWork.stateNode;
11298 if (finishedWork.effectTag & Update) {
11299 if (current === null) {
11300 startPhaseTimer(finishedWork, 'componentDidMount');
11301 _instance.props = finishedWork.memoizedProps;
11302 _instance.state = finishedWork.memoizedState;
11303 _instance.componentDidMount();
11304 stopPhaseTimer();
11305 } else {
11306 var prevProps = current.memoizedProps;
11307 var prevState = current.memoizedState;
11308 startPhaseTimer(finishedWork, 'componentDidUpdate');
11309 _instance.props = finishedWork.memoizedProps;
11310 _instance.state = finishedWork.memoizedState;
11311 _instance.componentDidUpdate(prevProps, prevState);
11312 stopPhaseTimer();
11313 }
11314 }
11315 var updateQueue = finishedWork.updateQueue;
11316 if (updateQueue !== null) {
11317 commitCallbacks(updateQueue, _instance);
11318 }
11319 return;
11320 }
11321 case HostRoot:
11322 {
11323 var _updateQueue = finishedWork.updateQueue;
11324 if (_updateQueue !== null) {
11325 var _instance2 = null;
11326 if (finishedWork.child !== null) {
11327 switch (finishedWork.child.tag) {
11328 case HostComponent:
11329 _instance2 = getPublicInstance(finishedWork.child.stateNode);
11330 break;
11331 case ClassComponent:
11332 _instance2 = finishedWork.child.stateNode;
11333 break;
11334 }
11335 }
11336 commitCallbacks(_updateQueue, _instance2);
11337 }
11338 return;
11339 }
11340 case HostComponent:
11341 {
11342 var _instance3 = finishedWork.stateNode;
11343
11344 // Renderers may schedule work to be done after host components are mounted
11345 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
11346 // These effects should only be committed when components are first mounted,
11347 // aka when there is no current/alternate.
11348 if (current === null && finishedWork.effectTag & Update) {
11349 var type = finishedWork.type;
11350 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