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

Function updateClassComponent

code/event-handlers/public/app.js:9188–9219  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9186 }
9187
9188 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9189 // Push context providers early to prevent context stack mismatches.
9190 // During mounting we don't know the child context yet as the instance doesn't exist.
9191 // We will invalidate the child context in finishClassComponent() right after rendering.
9192 var hasContext = pushLegacyContextProvider(workInProgress);
9193 var shouldUpdate = void 0;
9194 if (current === null) {
9195 if (workInProgress.stateNode === null) {
9196 // In the initial pass we might need to construct the instance.
9197 constructClassInstance(workInProgress, workInProgress.pendingProps);
9198 mountClassInstance(workInProgress, renderExpirationTime);
9199
9200 shouldUpdate = true;
9201 } else {
9202 // In a resume, we'll already have an instance we can reuse.
9203 shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
9204 }
9205 } else {
9206 shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
9207 }
9208
9209 // We processed the update queue inside updateClassInstance. It may have
9210 // included some errors that were dispatched during the commit phase.
9211 // TODO: Refactor class components so this is less awkward.
9212 var didCaptureError = false;
9213 var updateQueue = workInProgress.updateQueue;
9214 if (updateQueue !== null && updateQueue.capturedValues !== null) {
9215 shouldUpdate = true;
9216 didCaptureError = true;
9217 }
9218 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime);
9219 }
9220
9221 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) {
9222 // 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