(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 |
| 9126 | markRef(current, workInProgress); |
| 9127 | |
| 9128 | if (!shouldUpdate && !didCaptureError) { |
| 9129 | // Context providers should defer to sCU for rendering |
| 9130 | if (hasContext) { |
| 9131 | invalidateContextProvider(workInProgress, false); |
| 9132 | } |
| 9133 | |
| 9134 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 9135 | } |
| 9136 | |
| 9137 | var ctor = workInProgress.type; |
| 9138 | var instance = workInProgress.stateNode; |
| 9139 | |
| 9140 | // Rerender |
| 9141 | ReactCurrentOwner.current = workInProgress; |
| 9142 | var nextChildren = void 0; |
| 9143 | if (didCaptureError && (!enableGetDerivedStateFromCatch || typeof ctor.getDerivedStateFromCatch !== 'function')) { |
| 9144 | // If we captured an error, but getDerivedStateFrom catch is not defined, |
| 9145 | // unmount all the children. componentDidCatch will schedule an update to |
| 9146 | // re-render a fallback. This is temporary until we migrate everyone to |
| 9147 | // the new API. |
| 9148 | // TODO: Warn in a future release. |
| 9149 | nextChildren = null; |
| 9150 | } else { |
| 9151 | { |
| 9152 | ReactDebugCurrentFiber.setCurrentPhase('render'); |
| 9153 | nextChildren = instance.render(); |
| 9154 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { |
| 9155 | instance.render(); |
| 9156 | } |
| 9157 | ReactDebugCurrentFiber.setCurrentPhase(null); |
| 9158 | } |
| 9159 | } |
| 9160 | |
| 9161 | // React DevTools reads this flag. |
| 9162 | workInProgress.effectTag |= PerformedWork; |
| 9163 | if (didCaptureError) { |
| 9164 | // If we're recovering from an error, reconcile twice: first to delete |
| 9165 | // all the existing children. |
| 9166 | reconcileChildrenAtExpirationTime(current, workInProgress, null, renderExpirationTime); |
| 9167 | workInProgress.child = null; |
| 9168 | // Now we can continue reconciling like normal. This has the effect of |
| 9169 | // remounting all children regardless of whether their their |
| 9170 | // identity matches. |
| 9171 | } |
| 9172 | reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime); |
| 9173 | // Memoize props and state using the values we just used to render. |
| 9174 | // TODO: Restructure so we never read values from the instance. |
| 9175 | memoizeState(workInProgress, instance.state); |
| 9176 | memoizeProps(workInProgress, instance.props); |
| 9177 | |
| 9178 | // The context might have changed so we need to recalculate it. |
| 9179 | if (hasContext) { |
| 9180 | invalidateContextProvider(workInProgress, true); |
| 9181 | } |
no test coverage detected