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

Function updateClassComponent

code/dependency-injection/public/app.js:9951–9982  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9949 }
9950
9951 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9952 // Push context providers early to prevent context stack mismatches.
9953 // During mounting we don't know the child context yet as the instance doesn't exist.
9954 // We will invalidate the child context in finishClassComponent() right after rendering.
9955 var hasContext = pushLegacyContextProvider(workInProgress);
9956 var shouldUpdate = void 0;
9957 if (current === null) {
9958 if (workInProgress.stateNode === null) {
9959 // In the initial pass we might need to construct the instance.
9960 constructClassInstance(workInProgress, workInProgress.pendingProps);
9961 mountClassInstance(workInProgress, renderExpirationTime);
9962
9963 shouldUpdate = true;
9964 } else {
9965 // In a resume, we'll already have an instance we can reuse.
9966 shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
9967 }
9968 } else {
9969 shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
9970 }
9971
9972 // We processed the update queue inside updateClassInstance. It may have
9973 // included some errors that were dispatched during the commit phase.
9974 // TODO: Refactor class components so this is less awkward.
9975 var didCaptureError = false;
9976 var updateQueue = workInProgress.updateQueue;
9977 if (updateQueue !== null && updateQueue.capturedValues !== null) {
9978 shouldUpdate = true;
9979 didCaptureError = true;
9980 }
9981 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime);
9982 }
9983
9984 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) {
9985 // Refs should update even if shouldComponentUpdate returns false

Callers 1

beginWorkFunction · 0.70

Calls 5

constructClassInstanceFunction · 0.70
mountClassInstanceFunction · 0.70
resumeMountClassInstanceFunction · 0.70
updateClassInstanceFunction · 0.70
finishClassComponentFunction · 0.70

Tested by

no test coverage detected