MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / updateClassComponent

Function updateClassComponent

code/composition/public/app.js:9996–10027  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9994 }
9995
9996 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9997 // Push context providers early to prevent context stack mismatches.
9998 // During mounting we don't know the child context yet as the instance doesn't exist.
9999 // We will invalidate the child context in finishClassComponent() right after rendering.
10000 var hasContext = pushLegacyContextProvider(workInProgress);
10001 var shouldUpdate = void 0;
10002 if (current === null) {
10003 if (workInProgress.stateNode === null) {
10004 // In the initial pass we might need to construct the instance.
10005 constructClassInstance(workInProgress, workInProgress.pendingProps);
10006 mountClassInstance(workInProgress, renderExpirationTime);
10007
10008 shouldUpdate = true;
10009 } else {
10010 // In a resume, we'll already have an instance we can reuse.
10011 shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
10012 }
10013 } else {
10014 shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
10015 }
10016
10017 // We processed the update queue inside updateClassInstance. It may have
10018 // included some errors that were dispatched during the commit phase.
10019 // TODO: Refactor class components so this is less awkward.
10020 var didCaptureError = false;
10021 var updateQueue = workInProgress.updateQueue;
10022 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10023 shouldUpdate = true;
10024 didCaptureError = true;
10025 }
10026 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime);
10027 }
10028
10029 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) {
10030 // 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