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

Function updateClassComponent

code/third-party/public/app.js:9091–9122  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

9089 }
9090
9091 function updateClassComponent(current, workInProgress, renderExpirationTime) {
9092 // Push context providers early to prevent context stack mismatches.
9093 // During mounting we don't know the child context yet as the instance doesn't exist.
9094 // We will invalidate the child context in finishClassComponent() right after rendering.
9095 var hasContext = pushLegacyContextProvider(workInProgress);
9096 var shouldUpdate = void 0;
9097 if (current === null) {
9098 if (workInProgress.stateNode === null) {
9099 // In the initial pass we might need to construct the instance.
9100 constructClassInstance(workInProgress, workInProgress.pendingProps);
9101 mountClassInstance(workInProgress, renderExpirationTime);
9102
9103 shouldUpdate = true;
9104 } else {
9105 // In a resume, we'll already have an instance we can reuse.
9106 shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
9107 }
9108 } else {
9109 shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
9110 }
9111
9112 // We processed the update queue inside updateClassInstance. It may have
9113 // included some errors that were dispatched during the commit phase.
9114 // TODO: Refactor class components so this is less awkward.
9115 var didCaptureError = false;
9116 var updateQueue = workInProgress.updateQueue;
9117 if (updateQueue !== null && updateQueue.capturedValues !== null) {
9118 shouldUpdate = true;
9119 didCaptureError = true;
9120 }
9121 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime);
9122 }
9123
9124 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) {
9125 // 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