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

Function updateClassComponent

code/styling/public/app.js:9858–9889  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9856 }
9857
9858 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9859 // Push context providers early to prevent context stack mismatches.
9860 // During mounting we don't know the child context yet as the instance doesn't exist.
9861 // We will invalidate the child context in finishClassComponent() right after rendering.
9862 var hasContext = pushLegacyContextProvider(workInProgress);
9863 var shouldUpdate = void 0;
9864 if (current === null) {
9865 if (workInProgress.stateNode === null) {
9866 // In the initial pass we might need to construct the instance.
9867 constructClassInstance(workInProgress, workInProgress.pendingProps);
9868 mountClassInstance(workInProgress, renderExpirationTime);
9869
9870 shouldUpdate = true;
9871 } else {
9872 // In a resume, we'll already have an instance we can reuse.
9873 shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
9874 }
9875 } else {
9876 shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
9877 }
9878
9879 // We processed the update queue inside updateClassInstance. It may have
9880 // included some errors that were dispatched during the commit phase.
9881 // TODO: Refactor class components so this is less awkward.
9882 var didCaptureError = false;
9883 var updateQueue = workInProgress.updateQueue;
9884 if (updateQueue !== null && updateQueue.capturedValues !== null) {
9885 shouldUpdate = true;
9886 didCaptureError = true;
9887 }
9888 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime);
9889 }
9890
9891 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) {
9892 // 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