(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime)
| 10027 | } |
| 10028 | |
| 10029 | function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) { |
| 10030 | // Refs should update even if shouldComponentUpdate returns false |
| 10031 | markRef(current, workInProgress); |
| 10032 | |
| 10033 | if (!shouldUpdate && !didCaptureError) { |
| 10034 | // Context providers should defer to sCU for rendering |
| 10035 | if (hasContext) { |
| 10036 | invalidateContextProvider(workInProgress, false); |
| 10037 | } |
| 10038 | |
| 10039 | return bailoutOnAlreadyFinishedWork(current, workInProgress); |
| 10040 | } |
| 10041 | |
| 10042 | var ctor = workInProgress.type; |
| 10043 | var instance = workInProgress.stateNode; |
| 10044 | |
| 10045 | // Rerender |
| 10046 | ReactCurrentOwner.current = workInProgress; |
| 10047 | var nextChildren = void 0; |
| 10048 | if (didCaptureError && (!enableGetDerivedStateFromCatch || typeof ctor.getDerivedStateFromCatch !== 'function')) { |
| 10049 | // If we captured an error, but getDerivedStateFrom catch is not defined, |
| 10050 | // unmount all the children. componentDidCatch will schedule an update to |
| 10051 | // re-render a fallback. This is temporary until we migrate everyone to |
| 10052 | // the new API. |
| 10053 | // TODO: Warn in a future release. |
| 10054 | nextChildren = null; |
| 10055 | } else { |
| 10056 | { |
| 10057 | ReactDebugCurrentFiber.setCurrentPhase('render'); |
| 10058 | nextChildren = instance.render(); |
| 10059 | if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) { |
| 10060 | instance.render(); |
| 10061 | } |
| 10062 | ReactDebugCurrentFiber.setCurrentPhase(null); |
| 10063 | } |
| 10064 | } |
| 10065 | |
| 10066 | // React DevTools reads this flag. |
| 10067 | workInProgress.effectTag |= PerformedWork; |
| 10068 | if (didCaptureError) { |
| 10069 | // If we're recovering from an error, reconcile twice: first to delete |
| 10070 | // all the existing children. |
| 10071 | reconcileChildrenAtExpirationTime(current, workInProgress, null, renderExpirationTime); |
| 10072 | workInProgress.child = null; |
| 10073 | // Now we can continue reconciling like normal. This has the effect of |
| 10074 | // remounting all children regardless of whether their their |
| 10075 | // identity matches. |
| 10076 | } |
| 10077 | reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime); |
| 10078 | // Memoize props and state using the values we just used to render. |
| 10079 | // TODO: Restructure so we never read values from the instance. |
| 10080 | memoizeState(workInProgress, instance.state); |
| 10081 | memoizeProps(workInProgress, instance.props); |
| 10082 | |
| 10083 | // The context might have changed so we need to recalculate it. |
| 10084 | if (hasContext) { |
| 10085 | invalidateContextProvider(workInProgress, true); |
| 10086 | } |
no test coverage detected