MCPcopy Index your code
hub / github.com/plotly/dash / updateClassComponent

Function updateClassComponent

dash/deps/react-dom@18.2.0.js:19634–19723  ·  view source on GitHub ↗
(current, workInProgress, Component, nextProps, renderLanes)

Source from the content-addressed store, hash-verified

19632 }
19633
19634 function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) {
19635 {
19636 // This is used by DevTools to force a boundary to error.
19637 switch (shouldError(workInProgress)) {
19638 case false:
19639 {
19640 var _instance = workInProgress.stateNode;
19641 var ctor = workInProgress.type; // TODO This way of resetting the error boundary state is a hack.
19642 // Is there a better way to do this?
19643
19644 var tempInstance = new ctor(workInProgress.memoizedProps, _instance.context);
19645 var state = tempInstance.state;
19646
19647 _instance.updater.enqueueSetState(_instance, state, null);
19648
19649 break;
19650 }
19651
19652 case true:
19653 {
19654 workInProgress.flags |= DidCapture;
19655 workInProgress.flags |= ShouldCapture; // eslint-disable-next-line react-internal/prod-error-codes
19656
19657 var error$1 = new Error('Simulated error coming from DevTools');
19658 var lane = pickArbitraryLane(renderLanes);
19659 workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); // Schedule the error boundary to re-render using updated state
19660
19661 var update = createClassErrorUpdate(workInProgress, createCapturedValueAtFiber(error$1, workInProgress), lane);
19662 enqueueCapturedUpdate(workInProgress, update);
19663 break;
19664 }
19665 }
19666
19667 if (workInProgress.type !== workInProgress.elementType) {
19668 // Lazy component props can't be validated in createElement
19669 // because they're only guaranteed to be resolved here.
19670 var innerPropTypes = Component.propTypes;
19671
19672 if (innerPropTypes) {
19673 checkPropTypes(innerPropTypes, nextProps, // Resolved props
19674 'prop', getComponentNameFromType(Component));
19675 }
19676 }
19677 } // Push context providers early to prevent context stack mismatches.
19678 // During mounting we don't know the child context yet as the instance doesn't exist.
19679 // We will invalidate the child context in finishClassComponent() right after rendering.
19680
19681
19682 var hasContext;
19683
19684 if (isContextProvider(Component)) {
19685 hasContext = true;
19686 pushContextProvider(workInProgress);
19687 } else {
19688 hasContext = false;
19689 }
19690
19691 prepareToReadContext(workInProgress, renderLanes);

Callers 2

mountLazyComponentFunction · 0.70
beginWorkFunction · 0.70

Calls 15

shouldErrorFunction · 0.70
pickArbitraryLaneFunction · 0.70
mergeLanesFunction · 0.70
createClassErrorUpdateFunction · 0.70
enqueueCapturedUpdateFunction · 0.70
checkPropTypesFunction · 0.70
getComponentNameFromTypeFunction · 0.70
isContextProviderFunction · 0.70
pushContextProviderFunction · 0.70
prepareToReadContextFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…