MCPcopy Index your code
hub / github.com/microsoft/SandDance / finishClassComponent

Function finishClassComponent

docs/external/js/react-dom.development.js:17262–17327  ·  view source on GitHub ↗
(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime)

Source from the content-addressed store, hash-verified

17260 }
17261
17262 function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
17263 // Refs should update even if shouldComponentUpdate returns false
17264 markRef(current, workInProgress);
17265 var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
17266
17267 if (!shouldUpdate && !didCaptureError) {
17268 // Context providers should defer to sCU for rendering
17269 if (hasContext) {
17270 invalidateContextProvider(workInProgress, Component, false);
17271 }
17272
17273 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
17274 }
17275
17276 var instance = workInProgress.stateNode; // Rerender
17277
17278 ReactCurrentOwner$1.current = workInProgress;
17279 var nextChildren;
17280
17281 if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
17282 // If we captured an error, but getDerivedStateFromError is not defined,
17283 // unmount all the children. componentDidCatch will schedule an update to
17284 // re-render a fallback. This is temporary until we migrate everyone to
17285 // the new API.
17286 // TODO: Warn in a future release.
17287 nextChildren = null;
17288
17289 {
17290 stopProfilerTimerIfRunning();
17291 }
17292 } else {
17293 {
17294 setIsRendering(true);
17295 nextChildren = instance.render();
17296
17297 if ( workInProgress.mode & StrictMode) {
17298 instance.render();
17299 }
17300
17301 setIsRendering(false);
17302 }
17303 } // React DevTools reads this flag.
17304
17305
17306 workInProgress.effectTag |= PerformedWork;
17307
17308 if (current !== null && didCaptureError) {
17309 // If we're recovering from an error, reconcile without reusing any of
17310 // the existing children. Conceptually, the normal children and the children
17311 // that are shown on error are two different sets, so we shouldn't reuse
17312 // normal children even if their identities match.
17313 forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderExpirationTime);
17314 } else {
17315 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
17316 } // Memoize state using the values we just used to render.
17317 // TODO: Restructure so we never read values from the instance.
17318
17319

Callers 3

updateClassComponentFunction · 0.85

Calls 8

markRefFunction · 0.85
setIsRenderingFunction · 0.85
reconcileChildrenFunction · 0.85
renderMethod · 0.45

Tested by

no test coverage detected