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

Function updateClassComponent

code/new-context-api/public/app.js:9219–9250  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9217 }
9218
9219 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9220 // Push context providers early to prevent context stack mismatches.
9221 // During mounting we don't know the child context yet as the instance doesn't exist.
9222 // We will invalidate the child context in finishClassComponent() right after rendering.
9223 var hasContext = pushLegacyContextProvider(workInProgress);
9224 var shouldUpdate = void 0;
9225 if (current === null) {
9226 if (workInProgress.stateNode === null) {
9227 // In the initial pass we might need to construct the instance.
9228 constructClassInstance(workInProgress, workInProgress.pendingProps);
9229 mountClassInstance(workInProgress, renderExpirationTime);
9230
9231 shouldUpdate = true;
9232 } else {
9233 // In a resume, we'll already have an instance we can reuse.
9234 shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
9235 }
9236 } else {
9237 shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
9238 }
9239
9240 // We processed the update queue inside updateClassInstance. It may have
9241 // included some errors that were dispatched during the commit phase.
9242 // TODO: Refactor class components so this is less awkward.
9243 var didCaptureError = false;
9244 var updateQueue = workInProgress.updateQueue;
9245 if (updateQueue !== null && updateQueue.capturedValues !== null) {
9246 shouldUpdate = true;
9247 didCaptureError = true;
9248 }
9249 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime);
9250 }
9251
9252 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) {
9253 // 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