MCPcopy Index your code
hub / github.com/tastejs/todomvc / commitLifeCycles

Function commitLifeCycles

examples/typescript-react/js/bundle.js:17020–17145  ·  view source on GitHub ↗
(finishedRoot, current$$1, finishedWork, committedExpirationTime)

Source from the content-addressed store, hash-verified

17018}
17019
17020function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
17021 switch (finishedWork.tag) {
17022 case FunctionComponent:
17023 case ForwardRef:
17024 case SimpleMemoComponent:
17025 {
17026 commitHookEffectList(UnmountLayout, MountLayout, finishedWork);
17027 break;
17028 }
17029 case ClassComponent:
17030 {
17031 var instance = finishedWork.stateNode;
17032 if (finishedWork.effectTag & Update) {
17033 if (current$$1 === null) {
17034 startPhaseTimer(finishedWork, 'componentDidMount');
17035 // We could update instance props and state here,
17036 // but instead we rely on them being set during last render.
17037 // TODO: revisit this when we implement resuming.
17038 {
17039 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
17040 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
17041 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
17042 }
17043 }
17044 instance.componentDidMount();
17045 stopPhaseTimer();
17046 } else {
17047 var prevProps = finishedWork.elementType === finishedWork.type ? current$$1.memoizedProps : resolveDefaultProps(finishedWork.type, current$$1.memoizedProps);
17048 var prevState = current$$1.memoizedState;
17049 startPhaseTimer(finishedWork, 'componentDidUpdate');
17050 // We could update instance props and state here,
17051 // but instead we rely on them being set during last render.
17052 // TODO: revisit this when we implement resuming.
17053 {
17054 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
17055 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
17056 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
17057 }
17058 }
17059 instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
17060 stopPhaseTimer();
17061 }
17062 }
17063 var updateQueue = finishedWork.updateQueue;
17064 if (updateQueue !== null) {
17065 {
17066 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
17067 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
17068 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
17069 }
17070 }
17071 // We could update instance props and state here,
17072 // but instead we rely on them being set during last render.
17073 // TODO: revisit this when we implement resuming.
17074 commitUpdateQueue(finishedWork, updateQueue, instance, committedExpirationTime);
17075 }
17076 return;
17077 }

Callers 1

commitAllLifeCyclesFunction · 0.85

Calls 12

commitHookEffectListFunction · 0.85
startPhaseTimerFunction · 0.85
getComponentNameFunction · 0.85
stopPhaseTimerFunction · 0.85
resolveDefaultPropsFunction · 0.85
commitUpdateQueueFunction · 0.85
getPublicInstanceFunction · 0.85
commitMountFunction · 0.85
getCommitTimeFunction · 0.85
componentDidMountMethod · 0.80
componentDidUpdateMethod · 0.80
invariantFunction · 0.70

Tested by

no test coverage detected