(finishedRoot, current, finishedWork, committedExpirationTime)
| 19909 | } |
| 19910 | |
| 19911 | function commitLifeCycles(finishedRoot, current, finishedWork, committedExpirationTime) { |
| 19912 | switch (finishedWork.tag) { |
| 19913 | case FunctionComponent: |
| 19914 | case ForwardRef: |
| 19915 | case SimpleMemoComponent: |
| 19916 | case Block: |
| 19917 | { |
| 19918 | // At this point layout effects have already been destroyed (during mutation phase). |
| 19919 | // This is done to prevent sibling component effects from interfering with each other, |
| 19920 | // e.g. a destroy function in one component should never override a ref set |
| 19921 | // by a create function in another component during the same commit. |
| 19922 | commitHookEffectListMount(Layout | HasEffect, finishedWork); |
| 19923 | |
| 19924 | return; |
| 19925 | } |
| 19926 | |
| 19927 | case ClassComponent: |
| 19928 | { |
| 19929 | var instance = finishedWork.stateNode; |
| 19930 | |
| 19931 | if (finishedWork.effectTag & Update) { |
| 19932 | if (current === null) { |
| 19933 | startPhaseTimer(finishedWork, 'componentDidMount'); // We could update instance props and state here, |
| 19934 | // but instead we rely on them being set during last render. |
| 19935 | // TODO: revisit this when we implement resuming. |
| 19936 | |
| 19937 | { |
| 19938 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { |
| 19939 | if (instance.props !== finishedWork.memoizedProps) { |
| 19940 | error('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'); |
| 19941 | } |
| 19942 | |
| 19943 | if (instance.state !== finishedWork.memoizedState) { |
| 19944 | error('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'); |
| 19945 | } |
| 19946 | } |
| 19947 | } |
| 19948 | |
| 19949 | instance.componentDidMount(); |
| 19950 | stopPhaseTimer(); |
| 19951 | } else { |
| 19952 | var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps); |
| 19953 | var prevState = current.memoizedState; |
| 19954 | startPhaseTimer(finishedWork, 'componentDidUpdate'); // We could update instance props and state here, |
| 19955 | // but instead we rely on them being set during last render. |
| 19956 | // TODO: revisit this when we implement resuming. |
| 19957 | |
| 19958 | { |
| 19959 | if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { |
| 19960 | if (instance.props !== finishedWork.memoizedProps) { |
| 19961 | error('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'); |
| 19962 | } |
| 19963 | |
| 19964 | if (instance.state !== finishedWork.memoizedState) { |
| 19965 | error('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'); |
| 19966 | } |
| 19967 | } |
| 19968 | } |
no test coverage detected