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

Function updateClassComponent

code/communication/public/app.js:9893–9924  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9891 }
9892
9893 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9894 // Push context providers early to prevent context stack mismatches.
9895 // During mounting we don't know the child context yet as the instance doesn't exist.
9896 // We will invalidate the child context in finishClassComponent() right after rendering.
9897 var hasContext = pushLegacyContextProvider(workInProgress);
9898 var shouldUpdate = void 0;
9899 if (current === null) {
9900 if (workInProgress.stateNode === null) {
9901 // In the initial pass we might need to construct the instance.
9902 constructClassInstance(workInProgress, workInProgress.pendingProps);
9903 mountClassInstance(workInProgress, renderExpirationTime);
9904
9905 shouldUpdate = true;
9906 } else {
9907 // In a resume, we'll already have an instance we can reuse.
9908 shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
9909 }
9910 } else {
9911 shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
9912 }
9913
9914 // We processed the update queue inside updateClassInstance. It may have
9915 // included some errors that were dispatched during the commit phase.
9916 // TODO: Refactor class components so this is less awkward.
9917 var didCaptureError = false;
9918 var updateQueue = workInProgress.updateQueue;
9919 if (updateQueue !== null && updateQueue.capturedValues !== null) {
9920 shouldUpdate = true;
9921 didCaptureError = true;
9922 }
9923 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime);
9924 }
9925
9926 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) {
9927 // 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