(current, workInProgress, Component, nextProps, renderLanes)
| 19661 | } |
| 19662 | |
| 19663 | function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) { |
| 19664 | { |
| 19665 | // This is used by DevTools to force a boundary to error. |
| 19666 | switch (shouldError(workInProgress)) { |
| 19667 | case false: |
| 19668 | { |
| 19669 | var _instance = workInProgress.stateNode; |
| 19670 | var ctor = workInProgress.type; // TODO This way of resetting the error boundary state is a hack. |
| 19671 | // Is there a better way to do this? |
| 19672 | |
| 19673 | var tempInstance = new ctor(workInProgress.memoizedProps, _instance.context); |
| 19674 | var state = tempInstance.state; |
| 19675 | |
| 19676 | _instance.updater.enqueueSetState(_instance, state, null); |
| 19677 | |
| 19678 | break; |
| 19679 | } |
| 19680 | |
| 19681 | case true: |
| 19682 | { |
| 19683 | workInProgress.flags |= DidCapture; |
| 19684 | workInProgress.flags |= ShouldCapture; // eslint-disable-next-line react-internal/prod-error-codes |
| 19685 | |
| 19686 | var error$1 = new Error('Simulated error coming from DevTools'); |
| 19687 | var lane = pickArbitraryLane(renderLanes); |
| 19688 | workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); // Schedule the error boundary to re-render using updated state |
| 19689 | |
| 19690 | var update = createClassErrorUpdate(workInProgress, createCapturedValueAtFiber(error$1, workInProgress), lane); |
| 19691 | enqueueCapturedUpdate(workInProgress, update); |
| 19692 | break; |
| 19693 | } |
| 19694 | } |
| 19695 | |
| 19696 | if (workInProgress.type !== workInProgress.elementType) { |
| 19697 | // Lazy component props can't be validated in createElement |
| 19698 | // because they're only guaranteed to be resolved here. |
| 19699 | var innerPropTypes = Component.propTypes; |
| 19700 | |
| 19701 | if (innerPropTypes) { |
| 19702 | checkPropTypes(innerPropTypes, nextProps, // Resolved props |
| 19703 | 'prop', getComponentNameFromType(Component)); |
| 19704 | } |
| 19705 | } |
| 19706 | } // Push context providers early to prevent context stack mismatches. |
| 19707 | // During mounting we don't know the child context yet as the instance doesn't exist. |
| 19708 | // We will invalidate the child context in finishClassComponent() right after rendering. |
| 19709 | |
| 19710 | |
| 19711 | var hasContext; |
| 19712 | |
| 19713 | if (isContextProvider(Component)) { |
| 19714 | hasContext = true; |
| 19715 | pushContextProvider(workInProgress); |
| 19716 | } else { |
| 19717 | hasContext = false; |
| 19718 | } |
| 19719 | |
| 19720 | prepareToReadContext(workInProgress, renderLanes); |
no test coverage detected
searching dependent graphs…