(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime)
| 9982 | } |
| 9983 | |
| 9984 | function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) { |
| 9985 | // Refs should update even if shouldComponentUpdate returns false |
| 9986 | markRef(current, workInProgress); |
| 9987 | |
| 9988 | if (!shouldUpdate && !didCaptureError) { |
| 9989 | // Context providers should defer to sCU for rendering |
| 9990 | if (hasContext) { |
| 9991 | invalidateContextProvider(workInProgress, false); |
| 9992 | } |
| 9993 | |
| 9994 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 9995 | } |
| 9996 | |
| 9997 | var ctor = workInProgress.type; |
| 9998 | var instance = workInProgress.stateNode; |
| 9999 | |
| 10000 | // Rerender |
| 10001 | ReactCurrentOwner.current = workInProgress; |
| 10002 | var nextChildren = void 0; |
| 10003 | if (didCaptureError && (!enableGetDerivedStateFromCatch || typeof ctor.getDerivedStateFromCatch !== 'function')) { |
| 10004 | // If we captured an error, but getDerivedStateFrom catch is not defined, |
| 10005 | // unmount all the children. componentDidCatch will schedule an update to |
| 10006 | // re-render a fallback. This is temporary until we migrate everyone to |
| 10007 | // the new API. |
| 10008 | // TODO: Warn in a future release. |
| 10009 | nextChildren = null; |
| 10010 | } else { |
| 10011 | { |
| 10012 | ReactDebugCurrentFiber.setCurrentPhase('render'); |
| 10013 | nextChildren = instance.render(); |
| 10014 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { |
| 10015 | instance.render(); |
| 10016 | } |
| 10017 | ReactDebugCurrentFiber.setCurrentPhase(null); |
| 10018 | } |
| 10019 | } |
| 10020 | |
| 10021 | // React DevTools reads this flag. |
| 10022 | workInProgress.effectTag |= PerformedWork; |
| 10023 | if (didCaptureError) { |
| 10024 | // If we're recovering from an error, reconcile twice: first to delete |
| 10025 | // all the existing children. |
| 10026 | reconcileChildrenAtExpirationTime(current, workInProgress, null, renderExpirationTime); |
| 10027 | workInProgress.child = null; |
| 10028 | // Now we can continue reconciling like normal. This has the effect of |
| 10029 | // remounting all children regardless of whether their their |
| 10030 | // identity matches. |
| 10031 | } |
| 10032 | reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime); |
| 10033 | // Memoize props and state using the values we just used to render. |
| 10034 | // TODO: Restructure so we never read values from the instance. |
| 10035 | memoizeState(workInProgress, instance.state); |
| 10036 | memoizeProps(workInProgress, instance.props); |
| 10037 | |
| 10038 | // The context might have changed so we need to recalculate it. |
| 10039 | if (hasContext) { |
| 10040 | invalidateContextProvider(workInProgress, true); |
| 10041 | } |
no test coverage detected